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

Enable allowJs with isolatedDeclarations #58262

Open
1 task done
weswigham opened this issue Apr 19, 2024 · 5 comments
Open
1 task done

Enable allowJs with isolatedDeclarations #58262

weswigham opened this issue Apr 19, 2024 · 5 comments
Labels
Experience Enhancement Noncontroversial enhancements

Comments

@weswigham
Copy link
Member

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

Today, an error is issued when allowJs is set alongside isolatedDeclarations - js and ts .d.ts emit use the same pipeline, so it really should work, provided the error generation logic isn't making too many syntax assumptions.

Mostly, unlocking this is going to involve looking through the isolatedDeclarations tests and copying them with their cast/annotation syntaxes swapped to jsdoc and filenames swapped to .js just to give confidence things are going to work OK (and that getEffectiveTypeNode is being used over a direct .type get in enough places in the error generator). There's a few other JS-specific error cases to look at (js's unique export/expression merges, for one) that may need some new errors, but the bulk of it is just ensuring the existing type node presence checking logic generalizes to jsdoc-sourced type nodes.

@weswigham weswigham added the Experience Enhancement Noncontroversial enhancements label Apr 19, 2024
@saram-aman
Copy link

@weswigham can you please assign the task to me, would share a PR!

@pokey
Copy link

pokey commented Jul 18, 2024

Probably not the same issue, but I get an error even if I inherit allowJs from a base config and then explicitly set it to false. I would assume the error should only fire if allowJs is set to true?

jyasskin added a commit to w3ctag/w3ctagbot that referenced this issue Oct 3, 2024
This also fixes most of the issues for passing --isolatedDeclarations except for
dotansimha/graphql-code-generator#10160 and
microsoft/TypeScript#58262.
@rauschma
Copy link

Is there a reason not to always allow isolatedDeclarations? I find the additional constraints useful regardless of whether or not I emit declaration files.

@jakebailey
Copy link
Member

At the implementation level, isolatedDeclarations diagnostics are extra declaration diagnostics produced by the declaration transformer, which we only run when declaration is enabled.

Theoretically it could be implemented such that isolatedDeclarations enables those checks (the diagnostics actually come from us running the transformer and then throwing away the resulting AST), but it is a change from the original design.

@samuelstroschein
Copy link

Here is a use case for allowJs in parallel to isolatedDeclarations opral/inlang-paraglide-js#160

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

No branches or pull requests

6 participants