Declaration or statement expected "export type"
See original GitHub issuehttps://github.com/pmndrs/jotai/blob/9bd3ea476d1a69f6f967a42a587c9bf8b0d16e41/src/index.ts#L4
import type
/export type
construct started being supported on TypeScript 3.8 and I just wanted to point that out because CRA still ships with 3.7.2
and this syntax won’t work if you don’t update TypeScript. It might be nice to add that on the documentation or use a different syntax for exporting types.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Exporting a function on typescript "declaration or statement ...
It seems that let myfunction = something that returns a function export {myfunction};. will do the trick.
Read more >Declaration or statement expected error in TypeScript
The "Declaration or statement expected" error occurs when we have a syntax error in our code, e.g. when destructuring, exporting, or have a...
Read more >export type error · Issue #656 · umijs/dumi - GitHub
[error] src/index.ts: SyntaxError: Declaration or statement expected. (3:1) [error] 1 | export { default as Button } from '.
Read more >Declaration or Statement Expected Error in TypeScript
Declaration or statement expected error also arises sometimes when exporting something that has been declared previously. Whenever this needed ...
Read more >intermittent "TS1128: Declaration or statement expected" on ...
The embedded typescript and editor shows errors. No errors are reported when building externally. import React from 'react'; export ...
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 Free
Top 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
Yeah, I didn’t mean to create a big of a deal with that, sorry. I’ll add the note and keep this issue as a reference. I’ll add the error to the title so people will find it when searching for it.
When I was trying CRA before, I updated typescript, which wasn’t a big deal. (I’m not sure if that holds now, because CRA v3 had some issues with typescript+eslint even without jotai.)
Would you like to add some notes in
./docs/typescript.md
? PR appreciated.