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.jsindex.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.
from Function in javascript file can't detect its own type with declaration file


No comments:
Post a Comment