Function in javascript file can't detect its own type with declaration file
12
Is it possible for a file that has a corresponding declaration file to detect its own type in vscode?
Other files can get the typings, but not the file itself.
note the any
but this has proper typing
Reproduction
- Create a folder
- Run
npm init
- Hit enter through everything
- Create 3 files
index.js
index.d.ts
import.js
index.js
async function test(input) {
return null
}
index.d.ts
type input_type = {
name: string,
salary: number
}
export function test(input : input_type) : Promise<null>
import.js
import * as t from './index'
t.test()
When you mouse over the test
function in index.js
it doesn't know its parameter type. But in import.js
it knows it.
How can I get the index.js
test
function to know its own type.
javascript typescript visual-studio-code typescript-typings
-
This typescript issue seems to be exactly about your problem: github.com/Microsoft/TypeScript/issues/14342. (With the resolution seeming to be essentially what TUTAMKHAMON mentioned in their answer.) – mihi Apr 26 at 20:51
Add a comment
|