rpt2: built-in options overrides: {
"noEmitHelpers": false,
"importHelpers": true,
"noResolve": false,
"noEmit": false,
"inlineSourceMap": false,
"outDir": "/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/placeholder",
"moduleResolution": 2,
"allowNonTsExtensions": true
}
rpt2: parsed tsconfig: {
"options": {
"rootDir": "/home/projects/github-kgn16z-grsqrq/libs/test/src",
"sourceMap": true,
"declaration": true,
"moduleResolution": 2,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": 2,
"module": 99,
"lib": [
"lib.es2017.d.ts",
"lib.dom.d.ts"
],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": "/home/projects/github-kgn16z-grsqrq",
"paths": {
"test": [
"libs/test/src/index.ts"
]
},
"pathsBasePath": "/home/projects/github-kgn16z-grsqrq/libs/test",
"jsx": 4,
"allowJs": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"outDir": "/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/placeholder",
"types": [
"node"
],
"declarationDir": "/home/projects/github-kgn16z-grsqrq/out/tsc-dts",
"configFilePath": "/home/projects/github-kgn16z-grsqrq/libs/test/tsconfig.lib.json",
"noEmitHelpers": false,
"noResolve": false,
"noEmit": false,
"inlineSourceMap": false,
"allowNonTsExtensions": true
},
"fileNames": [
"/home/projects/github-kgn16z-grsqrq/node_modules/@nrwl/react/typings/cssmodule.d.ts",
"/home/projects/github-kgn16z-grsqrq/node_modules/@nrwl/react/typings/image.d.ts",
"/home/projects/github-kgn16z-grsqrq/libs/test/src/index.ts",
"/home/projects/github-kgn16z-grsqrq/libs/test/src/makeStyles.ts",
"/home/projects/github-kgn16z-grsqrq/libs/test/src/types.ts"
],
"typeAcquisition": {
"enable": false,
"include": [],
"exclude": []
},
"raw": {
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": [
"node"
],
"rootDir": "/home/projects/github-kgn16z-grsqrq/libs/test/src",
"allowJs": false,
"declaration": true,
"declarationDir": "/home/projects/github-kgn16z-grsqrq/out/tsc-dts",
"paths": {
"test": [
"libs/test/src/index.ts"
]
}
},
"files": [
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
"../../node_modules/@nrwl/react/typings/image.d.ts"
],
"exclude": [
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx"
],
"include": [
"**/*.js",
"**/*.jsx",
"**/*.ts",
"**/*.tsx"
],
"compileOnSave": false
},
"errors": [],
"wildcardDirectories": {
"/home/projects/github-kgn16z-grsqrq/libs/test": 1
},
"compileOnSave": false
}
rpt2: typescript version: 4.4.4
rpt2: tslib version: 2.3.1
rpt2: rollup version: 2.65.0
rpt2: rollup-plugin-typescript2 version: 0.31.1
rpt2: plugin options:
{
"check": true,
"tsconfig": "libs/test/tsconfig.lib.json",
"useTsconfigDeclarationDir": true,
"verbosity": 4,
"tsconfigOverride": {
"compilerOptions": {
"rootDir": "/home/projects/github-kgn16z-grsqrq/libs/test/src",
"allowJs": false,
"declaration": true,
"declarationDir": "/home/projects/github-kgn16z-grsqrq/out/tsc-dts",
"paths": {
"test": [
"libs/test/src/index.ts"
]
}
}
},
"clean": false,
"cacheRoot": "/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2",
"include": [
"*.ts+(|x)",
"**/*.ts+(|x)"
],
"exclude": [
"*.d.ts",
"**/*.d.ts"
],
"abortOnError": true,
"rollupCommonJSResolveHack": false,
"transformers": [],
"tsconfigDefaults": {},
"objectHashIgnoreUnknownHack": false,
"cwd": "/home/projects/github-kgn16z-grsqrq",
"typescript": "version 4.4.4"
}
rpt2: rollup config:
{
"external": [],
"input": "/home/projects/github-kgn16z-grsqrq/libs/test/src/index.ts",
"plugins": [
{
"name": "rpt2"
},
{
"name": "stdin"
}
],
"output": [
{
"file": "/home/projects/github-kgn16z-grsqrq/out/bundle.js",
"format": "es",
"plugins": []
}
]
}
rpt2: tsconfig path: /home/projects/github-kgn16z-grsqrq/libs/test/tsconfig.lib.json
rpt2: included:
[
"*.ts+(|x)",
"**/*.ts+(|x)"
]
rpt2: excluded:
[
"*.d.ts",
"**/*.d.ts"
]
rpt2: Ambient types:
rpt2: /home/projects/github-kgn16z-grsqrq/node_modules/@nrwl/react/typings/cssmodule.d.ts
rpt2: /home/projects/github-kgn16z-grsqrq/node_modules/@nrwl/react/typings/image.d.ts
rpt2: /home/projects/github-kgn16z-grsqrq/node_modules/@types/node/index.d.ts
rpt2: transpiling '/home/projects/github-kgn16z-grsqrq/libs/test/src/index.ts'
rpt2: cache: '/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/rpt2_4b2584b8fec2cb2070a57cc5fc1737a58e40ee79/code/cache/c054c5afccc541591135fb48ef93844cf144244d'
rpt2: cache hit
rpt2: cache: '/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/rpt2_4b2584b8fec2cb2070a57cc5fc1737a58e40ee79/syntacticDiagnostics/cache/c054c5afccc541591135fb48ef93844cf144244d'
rpt2: cache hit
rpt2: cache: '/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/rpt2_4b2584b8fec2cb2070a57cc5fc1737a58e40ee79/semanticDiagnostics/cache/c054c5afccc541591135fb48ef93844cf144244d'
rpt2: cache hit
rpt2: generated declarations for '/home/projects/github-kgn16z-grsqrq/libs/test/src/index.ts'
rpt2: dependency '/home/projects/github-kgn16z-grsqrq/libs/test/src/makeStyles.ts'
rpt2: imported by '/home/projects/github-kgn16z-grsqrq/libs/test/src/index.ts'
rpt2: resolving './makeStyles' imported by '/home/projects/github-kgn16z-grsqrq/libs/test/src/index.ts'
rpt2: to '/home/projects/github-kgn16z-grsqrq/libs/test/src/makeStyles.ts'
rpt2: transpiling '/home/projects/github-kgn16z-grsqrq/libs/test/src/makeStyles.ts'
rpt2: cache: '/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/rpt2_4b2584b8fec2cb2070a57cc5fc1737a58e40ee79/code/cache/f1f8bd7cd1ae728a9fe42101454aeb9263d56bc2'
rpt2: cache hit
rpt2: cache: '/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/rpt2_4b2584b8fec2cb2070a57cc5fc1737a58e40ee79/syntacticDiagnostics/cache/f1f8bd7cd1ae728a9fe42101454aeb9263d56bc2'
rpt2: cache hit
rpt2: cache: '/home/projects/github-kgn16z-grsqrq/node_modules/.cache/rollup-plugin-typescript2/rpt2_4b2584b8fec2cb2070a57cc5fc1737a58e40ee79/semanticDiagnostics/cache/f1f8bd7cd1ae728a9fe42101454aeb9263d56bc2'
rpt2: cache hit
rpt2: generated declarations for '/home/projects/github-kgn16z-grsqrq/libs/test/src/makeStyles.ts'
rpt2: generating target 1
rpt2: rolling caches
rpt2: generating missed declarations for '/home/projects/github-kgn16z-grsqrq/node_modules/@nrwl/react/typings/cssmodule.d.ts'
rpt2: generating missed declarations for '/home/projects/github-kgn16z-grsqrq/node_modules/@nrwl/react/typings/image.d.ts'
rpt2: generating missed declarations for '/home/projects/github-kgn16z-grsqrq/libs/test/src/types.ts'
rpt2: emitting declarations for '/home/projects/github-kgn16z-grsqrq/libs/test/src/index.ts' to '/home/projects/github-kgn16z-grsqrq/out/tsc-dts/index.d.ts'
rpt2: emitting declarations for '/home/projects/github-kgn16z-grsqrq/libs/test/src/makeStyles.ts' to '/home/projects/github-kgn16z-grsqrq/out/tsc-dts/makeStyles.d.ts'
rpt2: emitting declarations for '/home/projects/github-kgn16z-grsqrq/libs/test/src/types.ts' to '/home/projects/github-kgn16z-grsqrq/out/tsc-dts/types.d.ts'
created out/bundle.js in 949ms
What happens and why it is wrong
When module contains only types (type,interface), and those types are being imported in other module, this plugin will omit those completely from type-checking which causes shipping invalid code to consumers.
🎬 Whole repro can be found here: https://stackblitz.com/edit/github-kgn16z-grsqrq?file=libs/test/rollup-config.js
yarn rollup:tsc(uses this plugin with rollup) -> this will produce no Type errors 🚨 (Wrong)yarn tsc:check(uses raw tsc) -> this will properly produce type errors ✅ (Correct, expected)Source Code
Versions
rollup.config.js
`rollup.config.js`:
tsconfig.json
`tsconfig.json`:
{ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc", "types": ["node"] }, "files": [ "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nrwl/react/typings/image.d.ts" ], "exclude": [ "**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "**/*.spec.js", "**/*.test.js", "**/*.spec.jsx", "**/*.test.jsx" ], "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] }package.json
`package.json`:
plugin output with verbosity 4
plugin output with verbosity 3:
Related issues
#211