With TypeScript 2.8, we have now the possiblity to generate .d.ts only from source files. So my tsconfig.json becomes :
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"target": "es5",
"lib": ["ES6","ES2017","ESNext"],
"downlevelIteration": true,
"moduleResolution": "node",
"declaration": true,
"emitDeclarationOnly": true,
"declarationDir": "./lib"
},
"exclude": [
"node_modules"
],
"include": [
"src/**/*"
],
"strict": true
}
The problem is the build is broken with that (https://travis-ci.org/jy95/mediaScan/jobs/359573738). My repo : https://github.com/jy95/mediaScan/tree/prettier
Any ideas how to fix it ?
My jest.config.js :
// jest.config.js
module.exports = {
verbose: true,
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testMatch": [
"<rootDir>/__tests__/**/*.(ts|tsx|js)"
],
"testPathIgnorePatterns": ["<rootDir>/node_modules/", "<rootDir>/__tests__/__helpers__/"],
"collectCoverage": true
};
Thanks
I've experienced similar issue when was switching jest
to process .js
files with ts-jest
instead of babel-jest
.
Error happens (according to stacktrace) at getConstructorDefinedThisAssignmentTypes
in typescript.js
. And is most likely caused by incorrect or missing types. Add some breakpoints or log types there/declarations to see what exactly is failing.
You can try to upgrade typescript
to the latest version, it might give more valuable error message, and try to tsc --noEmit
to see if there are some loose ends with your types.
Also sometimes npx jest --clearCache
helps