Skip to content

allowJs compiler option doesn't document its conditional default behaviorΒ #62644

@manbearwiz

Description

@manbearwiz

πŸ”Ž 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions