[react native] Namespace not marked type-only declare.
See original GitHub issueTensorFlow.js version
1.3.2
TensorFlow.js react-native version
0.1.0-alpha.2
Browser version
react-native 0.59.8 expo sdk 35.0.0 expo version 3.7.1
Describe the problem or feature request
Hi, I follow the steps in the page https://github.com/tensorflow/tfjs/tree/master/tfjs-react-native for a expo managed app, but I get the following error
node_modules/@tensorflow/tfjs-converter/dist/src/data/compiled_api.ts:
/Users/itachi/my-apps/react/react-native/mobile-net/node_modules/@tensorflow/tfjs-converter/dist/src/data/compiled_api.ts:
Namespace not marked type-only declare. Non-declarative namespaces are only supported experimentally in Babel.
To enable and review caveats see: https://babeljs.io/docs/en/babel-plugin-transform-typescript
70 | }
71 |
> 72 | export namespace TensorShape {
| ^^^^^^^^^^^
73 | /** Properties of a Dim. */
74 | export declare interface IDim {
75 | /** Dim size */
Failed building JavaScript bundle.
Code to reproduce the bug / link to feature request
These are the commands I’ve run
expo init mobile-net (-> Managed workflow)
cd mobile-net
expo install expo-gl
npm install @tensorflow/tfjs
npm install @tensorflow/tfjs-react-native@alpha
npm install @react-native-community/async-storage
npm install react-native-fs
Added the lines in the App.js file
import * as tf from '@tensorflow/tfjs';
import '@tensorflow/tfjs-react-native';
then
expo start
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Namespace not marked type-only declare - Babel/Typescript
I used the packages react-app-rewired with the cutomize-cra. I created the config-overrides.js to overrides the config about cra (create-react- ...
Read more >Namespace not marked type-only declare - Babel/Typescript ...
Mark type-only namespace s with declare . The regular allowNamespaces right into .babelrc would not work with create-react-app .
Read more >Javascript – Namespace not marked type-only declare – Babel ...
I have created app via npx create-react-app –typescript. And I wanted to use some autogenerated code with namespaces due to that babel throw...
Read more >babel/plugin-transform-typescript
It's not going away, but there are modern alternatives. Type-only namespace s should be marked with declare and will subsequently be safely removed....
Read more >Documentation - TypeScript 3.8
Is only 'Foo' a type? Or every declaration in the import? // We just give an error because it's not clear. import type...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I found the following solution. I installed the packages
Then I create, in the root of the project the file
metro.config.js
asAnd the file
tsconfig.json
asAt the moment I have no problem
The error message is asking you to add “declare” to the namespace. You can defined your namespace like so:
declare namespace MyNamespace {...}
ORexport declare namespace MyNamespace {...}