Closed
Description
TypeScript Version: "3.7.0-dev.20191001"
Search Terms:
Code
// file.jsx
import PropTypes from 'prop-types';
import React from 'react';
const propTypes = {
bar: PropTypes.bool,
};
const defaultProps = {
bar: false,
};
function Foo({ bar }) {
return <div>{bar}</div>;
}
Foo.propTypes = propTypes;
Foo.defaultProps = defaultProps;
export default Foo;
compiler options
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"jsx": "react",
"lib": ["dom", "es2017", "esnext.asynciterable"],
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"composite": true,
"esModuleInterop": true,
"downlevelIteration": true,
"strict": true,
"noErrorTruncation": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"importHelpers": true
},
"exclude": ["node_modules", "projects/*/node_modules", "projects/*/lib", "projects/*/build"]
}
{
"extends": "./tsconfig.settings.json",
"compilerOptions": {
"allowJs": true
},
"files": [
"/path/to/file.jsx"
]
}
Expected behavior:
No error
Actual behavior:
Compiler crashes with:
/work/node_modules/typescript/lib/tsc.js:78403
throw e;
^
TypeError: Cannot read property 'declarations' of undefined
at getSpecifierForModuleSymbol (/work/node_modules/typescript/lib/tsc.js:30502:61)
at serializeAsAlias (/work/node_modules/typescript/lib/tsc.js:31191:171)
at serializeSymbolWorker (/work/node_modules/typescript/lib/tsc.js:30971:25)
at serializeSymbol (/work/node_modules/typescript/lib/tsc.js:30923:38)
at /work/node_modules/typescript/lib/tsc.js:30908:29
at Map.forEach (<anonymous>)
at visitSymbolTable (/work/node_modules/typescript/lib/tsc.js:30907:42)
at serializeAsNamespaceDeclaration (/work/node_modules/typescript/lib/tsc.js:31132:25)
at serializeModule (/work/node_modules/typescript/lib/tsc.js:31051:25)
at serializeSymbolWorker (/work/node_modules/typescript/lib/tsc.js:30965:25)