Skip to content

Configuration For Treating JS/TS Files as Independent Units (modules) #14279

Closed
@mjbvz

Description

@mjbvz

From microsoft/vscode#16892

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code
For a JavaScript project

jsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "allowSyntheticDefaultImports": false
    }
}

a.js

var foo = 'test'

b.js

var foo = 2

Expected behavior:
There should be a way to configure TypeScript to treat a.js and b.js as isolated units. That way, foo would have the type as defined in its file

Actual behavior:
The files are treated as a single unit. foo either has a string or number type in both files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureFix AvailableA PR has been opened for this issueSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions