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

Nodenext not recognized as moduleResolution #47311

Closed
jmclean-starburst opened this issue Jan 4, 2022 · 7 comments
Closed

Nodenext not recognized as moduleResolution #47311

jmclean-starburst opened this issue Jan 4, 2022 · 7 comments
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@jmclean-starburst
Copy link

Bug Report

When using Typescript v4.5.4 along with VS Code v1.63.2, nodenext appears to be running into incompatability issues:
image

hovering over the moduleResolution IDE hint provides the below message when value is nodenext

Value is not accepted. Valid values: "Classic", "Node".

hovering over the module IDE hint provides the below message when value is nodenext

Compiler option 'module' of value 'nodenext' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.

compiler options configured based on docs: https://www.typescriptlang.org/tsconfig#moduleResolution

🙁 Actual behavior

typescript compilation error

> tsc
tsconfig.json:6:15 - error TS4124: Compiler option 'module' of value 'nodenext' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.

6     "module": "nodenext",
                ~~~~~~~~~~


Found 1 error.

🙂 Expected behavior

Typescript compilation is happy

@MartinJohns
Copy link
Contributor

This is intentional, and the compiler error tells you this. See #46454 for more information. nodenext is only supported when using a nightly version, and 4.5.4 is not a nightly version.

@jmclean-starburst
Copy link
Author

@MartinJohns thanks for the speedy response; I have the below error when trying to compile, which is confusing considering the module is nodenext and the target is esnext

> tsc
tp-entry.ts:31:6 - error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.

31 if (!await validateAcct(acctNum)) {
        ~~~~~


Found 1 error in /Users/me/ref/packages/aws/vpc/tp-entry.ts:31

TS version

> tsc --version
Version 4.6.0-dev.20220104
> node_modules/.bin/tsc --version
Version 4.6.0-dev.20220104

@MartinJohns
Copy link
Contributor

That's a bug, see #46869. Used search terms: nodenext in:title

@jmclean-starburst
Copy link
Author

@MartinJohns thanks for the pro-tip; I had seen that issue but saw it was from 2 months ago and wasnt sure if it was still relavent.

FWIW - the VS Code IDE still complains, even with the nightly version
image

@MartinJohns
Copy link
Contributor

By default VS Code is using whatever TypeScript version it is shipped with, not your local TypeScript version. You can explicitly change this.

image
image

@DanielRosenwasser
Copy link
Member

Thanks for helping out @MartinJohns!

@DanielRosenwasser DanielRosenwasser added the External Relates to another program, environment, or user action which we cannot control. label Jan 6, 2022
@typescript-bot
Copy link
Collaborator

This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

4 participants