microsoft/TypeScript

`allowJs` compiler option doesn't document its conditional default behavior

Closed this issue ยท 1 comments

๐Ÿ”Ž Search Terms

allowJs, checkJs, default value, help

๐Ÿ•— Version & Regression Information

  • The default value changed in this PR, without corresponding documentation changes.

โฏ Playground Link

No response

๐Ÿ’ป Code

No response

๐Ÿ™ Actual behavior

tsc just states that the default is false

$ tsc --help --all | grep -A3 "allowJs"
--allowJs
Allow JavaScript files to be a part of your program. Use the 'checkJs' option to get errors from these files.
type: boolean
default: false

๐Ÿ™‚ Expected behavior

tsc correctly states that is is conditional

$ tsc --help --all | grep -A3 "allowJs"
--allowJs
Allow JavaScript files to be a part of your program. Use the 'checkJs' option to get errors from these files.
type: boolean
default: `false`, unless `checkJs` is set

Additional information about the issue

Similar conditional defaults are already documented for other options:

%  tsc --help --all | grep -A3 "noImplicitAny"
--noImplicitAny
Enable error reporting for expressions and declarations with an implied 'any' type.
type: boolean
default: `false`, unless `strict` is set
%  tsc --help --all | grep -A3 "\-\-declaration"
--declaration, -d
Generate .d.ts files from TypeScript and JavaScript files in your project.
type: boolean
default: `false`, unless `composite` is set

I've seen some confusion around this, most recently in @tsconfig/strictest, where they set checkJs: true and allowJs: undefined with the intention of not allowing js unless explicitly set by extending configs (tsconfig/bases#88).

I opened #62611 to update the default value description to fix this

Fixed by #62611