I tried copying TypeScript and Jest config from Z. My code is available on GitHub
tsconfig.json
has:
"lib": [ "es5", "es6", "es7", "esnext", "dom" ],
"target": "es2018",
"esModuleInterop": true,
"moduleResolution": "node",
Imports work if I specify .js
extensions but not if there's no extension.
Jest config:
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testRegex: "test/.*\\.test\\.ts$",
moduleFileExtensions: ["ts", "js", "json", "node"],
Babel config:
module.exports = { presets: ["@babel/preset-env"] };
Imports work when there's no extension but do not work if there's a "js" extension.
Target needed to be set to "target": "ESNext"
and then extension is no longer needed to run the code.