scarf
scarf8mo ago

type checking `.js` files using `d.ts` files

would it be possible to type check javascript files using d.ts files?
// add.js
/// <reference types="./add.d.ts" />
const add = (a) => a + 1
// add.js
/// <reference types="./add.d.ts" />
const add = (a) => a + 1
// add.d.ts
export declare const add: (a: number) => number
// add.d.ts
export declare const add: (a: number) => number
importing add from add.js from consumer will type check but
0 Replies
No replies yetBe the first to reply to this messageJoin