Skip to content

Use d.ts specified types within a JavaScript Module Itself #14342

Closed
@mjbvz

Description

@mjbvz

From microsoft/vscode#21454

TypeScript Version: 2.2.1

Code
For a javascript project
a.js:

export function abc( x, y ) { }

a.d.ts:

export declare function abc(x: number, y: number): boolean;

b.js

import { abc } from './a'

Expected behavior:
Within both a.js and b.js, the type of abc is (number, number) => boolean

Actual behavior:
Within a.js, the type of abc is (any, any) => void
Within b.js, the type of abc is (number, number) => boolean

The d.ts file is not applied within a module itself, only when it is imported into other files

Metadata

Metadata

Assignees

No one assigned

    Labels

    VS Code TrackedThere is a VS Code equivalent to this issueWorking 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