Skip to content

Having both a .ts and .js file with the same name breaks intellisense #41012

@FlowIT-JIT

Description

@FlowIT-JIT

Having e.g. test.js and test.ts in the same project partially breaks intellisense.

Expected behavior:

Since value might be undefined , I would expect an error - just like we get when there is no test.ts present.

image

Actual behavior:

Notice how test.ts is now present (it's just an empty file), and we no longer receive an error - but the intellisense partially works, as the tool tip reveals the type of value.

image

Notice how it no longer knows that value might be undefined. It's like the validation rules for .ts files are being used for .js files all of a sudden.

If we rename test.ts to test2.ts, then intellisense works again.

image

Content of jsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "checkJs": true,
        "resolveJsonModule": true,
        "strictNullChecks": true,
        "noImplicitAny": true
    }
}

Tested with TypeScript 4.0.3 and TypeScript@Next (4.1.0-dev.20201009).

VSCode:

Version: 1.50.0
Commit: 93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3
Date: 2020-10-07T06:00:00.397Z (2 days ago)
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 17.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions