envs
envs copied to clipboard
import type
Describe the bug
Using the statement import type { SomeType } from './Component.d.ts'
throws a parsing error.
I'm not sure if this is related: https://github.com/babel/babel/issues/10981
Steps to Reproduce
- Use
import type { SomeType } from './Component.d.ts'
Expected Behavior
It should not throw any parsing errors as Typescript 3.8 supports this.
Screenshots, exceptions and logs
When running bit status
you get a parsing error as if import type...
is not valid synthax:
Same goes for when running bit build
:
If applicable, add screenshots, exceptions, and logs to help explain your problem.
Specifications
- Bit version: 14.7.6
- Node version: 12.16.2
- npm / yarn version: 6.14.4
- Platform: Windows 10 x64
- Compiler / Tester (include version): [email protected]
@GiladShoham - seems like Bit TS requires upgrading to 3.8
@Tallyb looks like you guys are already on 3.8.3 https://github.com/teambit/envs/blob/master/package.json#L63
But on the babel compiler package you’re on 3.6.2: https://github.com/teambit/envs/blob/master/packages/babel/package.json#L13
I think the issue is related to babel perhaps: https://github.com/babel/babel/issues/10981
I'm not sure 3.8.3 is already in production, but we can publish it I think
@GiladShoham it would be great, Right now I'm at a standstill because of this and #89 / #2306
The compiler is on 3.8.3, but Bit needs also to be on 3.8 for the AST analysis to work correctly.
On Wed, Apr 15, 2020 at 11:36 PM Pierre Bérubé [email protected] wrote:
@GiladShoham https://github.com/GiladShoham it would be great, Right now I'm at a standstill because of this and #89 https://github.com/teambit/envs/issues/89 / #2306 https://github.com/teambit/bit/issues/2306
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/teambit/envs/issues/124#issuecomment-614266762, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYLJDYFQWGK3QQDQZISGW3RMYLELANCNFSM4MHECQFQ .
I just opened a PR for this. https://github.com/teambit/bit/pull/2592
Merged. Hopefully will be released early next week
I've tested the prod branch on a trivial component with import type. It seems like there is a parsing error (both production CLI and prod branch).
✔ 10313 20:22:01
new components
(use "bit tag --all [version]" to lock a version with all your changes)
> comp ... issues found
error found while parsing the file (please edit the file and fix the parsing error):
comp.ts -> '=' expected.
see troubleshooting at https://docs.bit.dev/docs/add-and-isolate-components#common-isolation-errors
The component still builds thought, so in order to solve this issue it would be great if you can provide some link to example repo or a public bit component @l0gicgate.
@qballer provide a repo for what exactly? You reproduced the problem, what do you want me to do?
There are two issues here from what I can tell. Bit's parsing has an error that involves the import type syntax and your component doesn't compile. The first might create issues with detecting dependencies but the compiler did manage to compile my component, so I'm wondering how exactly does it fail to compile on your end. A contrived example would do if there is an issue sharing source code.
@qballer the component compiles if I remove the import type
synthax and simply use import { MyType}