Open miguelramos opened 4 years ago
@miguelramos Could you provide a more complete repro? I tried with the files you shared, but I didn't encounter any error.
The ideal would be a complete branch with a tsconfig.json
file and instructions for building. Thanks!
Hey @octogonz sorry for the delay, but this is a private company project but i can share the tsconfig files. This is a monorepo (lerna), with gulp, rollup and babel.
tsconfig.json
{
"compilerOptions": {
"composite": true,
"target": "es5",
"module": "es2015",
"lib": [
"es2015",
"es2016",
"es2017",
"es2018",
"dom",
"dom.iterable"
],
"allowJs": true,
"jsx": "preserve",
"sourceMap": true,
"outDir": "./dist",
"downlevelIteration": true,
"strict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"@company/support/*": ["packages/support"],
"@company/support": ["packages/support/main.ts"],
"@company/ui/*": ["packages/ui"],
"@company/ui": ["packages/ui/index.ts"],
"@company/composition/*": ["packages/composition"],
"@company/data-query/*": ["packages/data-query"],
"@company/data-query": ["packages/data-query/main.ts"],
"@company/http": ["packages/http/index.ts"],
},
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"exclude": [
"**/*.spec.ts",
"**/*.spec.js",
"node_modules",
"dist"
]
}
tsconfig.build.json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"outDir": "dist",
"moduleResolution": "node",
"baseUrl": "./",
"preserveSymlinks": true,
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"declarationDir": "types",
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"jsxFactory": "h",
"rootDir": ".",
"strict": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"types": ["jest", "webpack-env", "node"]
},
"exclude": ["./tsconfig.build.json", "./scripts"],
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.d.ts"]
}
babel config in gulp
babel({
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
include: [join(settings.sourceDir, '**/*')],
plugins: [
'@babel/plugin-syntax-jsx',
[
'@babel/plugin-proposal-decorators',
{
legacy: true
}
],
'@babel/plugin-proposal-class-properties'
],
presets: [
[
'@babel/preset-env',
{
modules: false
}
],
'@babel/preset-typescript',
'@vue/cli-plugin-babel/preset'
],
// externalHelpers: true,
runtimeHelpers: true
}),
api-extractor.json
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"projectFolder": "./",
"mainEntryPointFilePath": "../../dist/packages/support/@types/main.d.ts",
"bundledPackages": [],
"compiler": {
"skipLibCheck": true,
"tsconfigFilePath": "./tsconfig.build.json"
},
"apiReport": {
"enabled": true,
"reportFileName": "support.api.md",
"reportFolder": "../../dist/packages/support/docs/"
},
"docModel": {
"enabled": true
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "../../dist/packages/support/support-raw.d.ts",
"betaTrimmedFilePath": "../../dist/packages/support/support-beta.d.ts",
"publicTrimmedFilePath": "../../dist/packages/support/index.d.ts"
},
"tsdocMetadata": {
"enabled": true,
"tsdocMetadataFilePath": "../../dist/packages/support/tsdoc-metadata.json"
},
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
}
}
}
}
Hey @octogonz sorry for the delay, but this is a private company project but i can share the tsconfig files. This is a monorepo (lerna), with gulp, rollup and babel.
What does API Extractor log with the --diagnostics
CLI parameter?
The diagnostic log shows all the input files that API Extractor reads during analysis, which will be mostly .d.ts files without any implementation details in them. The .js and .ts files are generally NOT needed to repro a crash. So if you are not able to share your full source code, maybe you could share only the .d.ts files (e.g. with comments deleted)? (If you want to send a file to me privately, you can use Gitter or Twitter.)
It is difficult to debug this without more to go on.
@octogonz sorry for the delay. After a long dig on my setup i've realised that rollup tooling with babel plugin was messing up with final compilation, so i've striped out files and compiled with tsc on a testing project and all good, so tried to undersant what rollup plugin was doing, and yes order is important on toolings like this. I fixed the issua and all good now. Sorry for the inconvenience, and thanks for the tips.
@octogonz there was a duplicate issue filed for this in https://github.com/microsoft/rushstack/issues/2220, which contains a reproduction. I can provide a reproduction as well if you're not able to use that one for whatever reason
@benmccann I just looked at the repro from #2220, however it seems unrelated to your #1972. Your issue may be unrelated to both of these bugs. Even though they all crash in _getExportOfAstModule()
, the underlying reasons could be somewhat different.
Is this a feature or a bug?
Please describe the actual behavior. Try to export a typescript type importing from one file and exported from other file(index).
Log Stack:
If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate. My files:
helpers.ts
index.ts
What is the expected behavior? Type being on dts file.
If this is a bug, please provide the tool version, Node.js version, and OS.