I'm progressively migrating a JavaScript React app (CRA) to TypeScript. After having ran npm i typescript @types/node @types/react @types/react-dom @types/jest and npx tsc --init, I assigned types to a utility function, says
export const toNumber = (s : string) : number => +s;
and changed the extension of the file containing it from .js to .ts.
Now, if I write
const n = toNumber(5);
in the very same .ts file, a typing error does show up on both react-scripts start and VSCode as expected. But if I import toNumber in a .js file and write the same expression, there is no error whatsoever.
Is it possible to enable typechecking of an imported TypeScript function in a .js file (while ignoring everything not typed)?