Skip to content

jsconfig.*.json don't have "allowJs": true by default #61704

Closed as not planned
Closed as not planned
@adamscott

Description

@adamscott

🔎 Search Terms

jsconfig resolution reference

🕗 Version & Regression Information

  • The issue was there for TypeScript (tsconfig.json) in 3.9.10
  • The issue was fixed on the TypeScript (tsconfig.json) (at least) in 4.0.8
  • The issue was always there for JavaScript (jsconfig.json)

⏯ Playground Link

No response

💻 Code

Minimal reproduction project

local-reference-files.zip

File tree

This is the file tree of the MRP.

.
├── javascript
│   ├── browser.js
│   ├── jsconfig.browser.json
│   ├── jsconfig.json
│   ├── jsconfig.node.json
│   └── node.js
└── typescript
    ├── browser.ts
    ├── node.ts
    ├── tsconfig.browser.json
    ├── tsconfig.json
    └── tsconfig.node.json

Files

// javascript/jsconfig.json
{
  "references": [{ "path": "./jsconfig.node.json" }, { "path": "./jsconfig.browser.json" }]
}
// javascript/jsconfig.browser.json
{
  "compilerOptions": {
    "composite": true
  },
  "include": ["browser.js"]
}
// javascript/jsconfig.node.json
{
  "compilerOptions": {
    "composite": true
  },
  "include": ["node.js"]
}
// typescript/tsconfig.json
{
  "references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.browser.json" }]
}
// typescript/tsconfig.browser.json
{
  "compilerOptions": {
    "composite": true
  },
  "include": ["browser.ts"]
}
// typescript/tsconfig.node.json
{
  "compilerOptions": {
    "composite": true
  },
  "include": ["node.ts"]
}

🙁 Actual behavior

In the typescript directory:

  • browser.ts resolves to use tsconfig.browser.json
  • node.ts resolves to use tsconfig.node.json

In the javascript directory:

  • browser.js resolves to use jsconfig.json
  • node.js resolves to use jsconfig.json
    (because jsconfig.*.json don't have "allowJs": true by default.)

🙂 Expected behavior

In the typescript directory:

  • browser.ts resolves to use tsconfig.browser.json
  • node.ts resolves to use tsconfig.node.json

In the javascript directory:

  • browser.js resolves to use jsconfig.browser.json
  • node.js resolves to use jsconfig.node.json

Additional information about the issue

  • It doesn't seem to matter that the file is called jsconfig.json or tsconfig.json, it seems that it's the resolution of JavaScript config files that is broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions