Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Missing initializer in const declaration #16

Open
simonihmig opened this issue Sep 24, 2024 · 5 comments
Open

SyntaxError: Missing initializer in const declaration #16

simonihmig opened this issue Sep 24, 2024 · 5 comments

Comments

@simonihmig
Copy link

For .js files (with allowJs: true) glint is emitting exports like export const foo: Foo, instead of export declare const foo: Foo (which you have test coverage for), that causes jscodeshift to throw that error. See facebook/jscodeshift#539, which you apparently have seen already.

I don't see a way to fix this properly, other than making jscodeshift be able to parse d.ts files, or reverting to Regex replacements instead of AST transforms?

What kinda helps is no not re-throw here, but just log the error and move on. At least when those js files the d.ts output has been generated for don't import gts...

@NullVoxPopuli
Copy link
Owner

Re throwing there isn't a hard requirement, i don't think. I expect library authors to be able to read their terminal output during a build.
If we remove the throw, i think i'd like than message colored yellow or red or something.
Thoughts?

@simonihmig
Copy link
Author

Yeah, I patch-package'd it to do that and also output the original e.message. Can add color and file a PR if you want!

@NullVoxPopuli
Copy link
Owner

that would be lovely! thank you!

I just noticed I never declared node support on this tool.
So... we could declare node22+ and then use the builtin styleText?
(would be major bump, obvs)

@simonihmig
Copy link
Author

TIL about styleText!

Seems it was added in 20.12 tho: https://nodejs.org/api/util.html#utilstyletextformat-text-options
Should I end up using this pkg in some non-personal projects, it would be nice to be able to use that version of node! 😉

@NullVoxPopuli
Copy link
Owner

node 20 it is!
(i have no reason not support it, since it has the features i want haha)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants