microsoft/TypeScript

tsconfig.json should default `maxNodeModuleJsDepth` to 1

speigg opened this issue · 2 comments

TypeScript Version: 2.4.1

Expected behavior:

Basically, I expected --allowJS to know about modules in node_modules that don't have typescript definitions, the same way that a jsConfig.json project does.

Actual behavior:

Typescript doesn't know about modules in node_modules until the maxNodeModuleJsDepth compiler option is set to 1 or greater. It seems that it used to default to 2, but this was changed to 0 in #10538 (for performance reasons I think?). Given that jsConfig.json defaults this value to 2, can tsConfig.json at least default to 1 so that the --allowJS option works with top-level node modules out of the box?

This is an intentional behavior, the information the compiler can pick up from a .js file is less than that from a .d.ts file. Users would get better experience in general if they used @types or wrote a .d.ts file for the library. the feature is still there, and you are more than welcome to set it to 1 or more if you so chose, but we do not believe this should be the default.

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.