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

inconsistent case for "module" field in node bases #209

Closed
dominikg opened this issue Aug 13, 2023 · 4 comments · Fixed by #234
Closed

inconsistent case for "module" field in node bases #209

dominikg opened this issue Aug 13, 2023 · 4 comments · Fixed by #234
Labels

Comments

@dominikg
Copy link

dominikg commented Aug 13, 2023

According to https://www.typescriptlang.org/tsconfig#module lowercase node16 is allowed, but node bases for node16 and up use upperfist Node16 here.

PS. bases for versions older than 16 (12, 14) use node16, which is lowercase but also kind of surprising, given that they use something more recent than the node version they should be used with/for.

@dominikg
Copy link
Author

dominikg commented Aug 13, 2023

http://json.schemastore.org/tsconfig has an enum with uppercase Node16 in it, but also a pattern that spells [Nn][Oo][Dd][Ee]16 so nODe16 would be fine? wth

that schema is linked from here https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#schema but contains a lot more patterns like this that technically allow using AlL tHE cAsES, why?

@orta
Copy link
Member

orta commented Aug 14, 2023

I'm pretty sure TypeScript will lowercase the values, which makes any case acceptable because "why not?" - I'm not offended if someone changes them all to lowercase

You're welcome to read up on the node16 changes in #197

@dominikg
Copy link
Author

I just noticed it due to a testcase failing while trying to update tsconfck to node18 (it expected lowercase like in the node14 base). Might end up refactoring the tests to use snapshots per node version and not use a public base to avoid this issue in the future.

The inconsistencies between the official bases, official json schema and official documentation would be my answer to the "why not" question. Even the internal structures are not all the same (eg node vs node10). Isn't the goal of typescript to improve consistency and avoid problems like this?

@orta
Copy link
Member

orta commented Aug 14, 2023

Not quite sure I get what you mean by the node vs node10? I don't think there was a node10 enum accepted by the tsconfig option for resolution but I've not fully kept on top of the tsconfig options these days

But it seems pretty reasonable for a config to lowercase their values when they are user-inputted enums in a JSON file like that, but it's also cool if you disagree.

A library throwing with the same input as typescript is kinda a bug on their side, but the case in this set of working tsconfigs isn't really something I'd think, so happy to have them all consistently lowercased 👍🏻

orta added a commit that referenced this issue Aug 21, 2023
fix:  inconsistent case for "module" field in node bases #209
@orta orta closed this as completed in #234 Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants