How can i declare that a ts file or files exports some methods?
For example there is a es6 file toyota.ts
export const turnLeft: number = (param1: string, param2: number) => {
// do it...
}
export const turnRight: number = (param1: string, param2: number) => {
// do it...
}
A second es6 file honda.ts
export const turnLeft: number = (param1: string, param2: number) => {
// do it...
}
export const turnRight: number = (param1: string, param2: number) => {
// do it...
}
How can i make a type file which describes both these ts files.
i.e. declare that the file has two exports which are called turnLeft and turnRight.
So that if I have a third file nissan.ts
and it only has turnLeft, then when I do tsc
it will tell me the error?
I have tried to enforce the toyota.ts
by making a toyota.d.ts
file with declare
in it. But when tsc -w
runs it does not even reload when i change the toyota.d.ts
. Having the toyota.d.ts
did nothing. So i could not even get the first step of getting one of the js file's exports to be checked, let alone all 3 files checked using the same declaration.
Thanks for any help.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…