-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Labels
kind: bugSomething isn't working properlySomething isn't working properlysolution: duplicateThis issue or pull request already existsThis issue or pull request already existstopic: TS Compiler API DocsRelated to the severely lacking TS Compiler API DocsRelated to the severely lacking TS Compiler API Docstopic: monorepo / symlinksRelated to monorepos and/or symlinks (Lerna, Yarn, PNPM, Rush, etc)Related to monorepos and/or symlinks (Lerna, Yarn, PNPM, Rush, etc)
Description
What happens and why it is wrong
When i want to using api-extractor to genderation my d.ts file, i found an error : InternalError: Internal Error: Unable to follow symbol for "Ref"
In the source code, I imported type. And then it lost in my rollup output code.
// origin
import { ref, Ref } from 'vue'
export function useTmp() {
const bl = ref(false) as Ref<boolean>
return {
bl
}
}
// output
export declare function useTmp(): {
bl: Ref<boolean>;
};
I think there should be something like this in the output code: import { Ref } from 'vue'
, but it didn't.
What should I do about it? Thanks.
Environment
Versions
rollup: ^2.73.0 => 2.73.0
rollup-plugin-typescript2: ^0.31.2 => 0.31.2
typescript: ^4.6.4 => 4.6.4
rollup.config.js
:
rollup.config.js
const typescript = require('rollup-plugin-typescript2')
const path = require('path')
export default {
input: 'src/index.ts',
external: ['vue'],
output: {
file: 'dist/index.js',
format: 'esm',
globals: {
vue: 'Vue'
}
},
plugins: [
typescript({
clean: true,
verbosity: 3,
check: false, // FIXED: https://github.com/ezolenko/rollup-plugin-typescript2/issues/234
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
tsconfigOverride: {
compilerOptions: {
declaration: true,
rootDir: path.resolve(__dirname),
},
},
}),
]
}
tsconfig.json
:
tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"outDir": "dist",
"sourceMap": false,
"target": "es2016",
"useDefineForClassFields": false,
"module": "esnext",
"moduleResolution": "node",
"allowJs": true,
"strict": true,
"noUnusedLocals": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"removeComments": false,
"jsx": "preserve",
"lib": ["esnext", "dom"],
"rootDir": "."
},
"include": [
"src"
]
}
package.json
:
package.json
{
"name": "tmp-rollup-api-extrator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "rollup -c",
"build:dts": "node ./scripts/dts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@microsoft/api-extractor": "^7.24.0",
"@types/node": "^17.0.33",
"rollup": "^2.73.0",
"rollup-plugin-typescript2": "^0.31.2",
"typescript": "^4.6.4",
"vue": "^3.2.33"
}
}
plugin output with verbosity 3
:
> rollup -c
rpt2: built-in options overrides: {
"noEmitHelpers": false,
"importHelpers": true,
"noResolve": false,
"noEmit": false,
"inlineSourceMap": false,
"outDir": "C:\\Users\\ash\\Desktop\\tmp-rollup-api-extrator\\node_modules\\.cache\\rollup-plugin-typescript2/placeholder",
"moduleResolution": 2,
"allowNonTsExtensions": true
}
rpt2: parsed tsconfig: {
"options": {
"baseUrl": "C:/Users/ash/Desktop/tmp-rollup-api-extrator",
"outDir": "C:\\Users\\ash\\Desktop\\tmp-rollup-api-extrator\\node_modules\\.cache\\rollup-plugin-typescript2/placeholder",
"sourceMap": false,
"target": 3,
"useDefineForClassFields": false,
"module": 99,
"moduleResolution": 2,
"allowJs": true,
"strict": true,
"noUnusedLocals": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"removeComments": false,
"jsx": 1,
"lib": [
"lib.esnext.d.ts",
"lib.dom.d.ts"
],
"rootDir": "C:/Users/ash/Desktop/tmp-rollup-api-extrator",
"declaration": true,
"configFilePath": "C:/Users/ash/Desktop/tmp-rollup-api-extrator/tsconfig.json",
"noEmitHelpers": false,
"importHelpers": true,
"noResolve": false,
"noEmit": false,
"inlineSourceMap": false,
"allowNonTsExtensions": true
},
"fileNames": [
"C:/Users/ash/Desktop/tmp-rollup-api-extrator/src/index.ts"
],
"typeAcquisition": {
"enable": false,
"include": [],
"exclude": []
},
"raw": {
"compilerOptions": {
"baseUrl": ".",
"outDir": "dist",
"sourceMap": false,
"target": "es2016",
"useDefineForClassFields": false,
"module": "esnext",
"moduleResolution": "node",
"allowJs": true,
"strict": true,
"noUnusedLocals": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"removeComments": false,
"jsx": "preserve",
"lib": [
"esnext",
"dom"
],
"rootDir": "C:\\Users\\ash\\Desktop\\tmp-rollup-api-extrator",
"declaration": true
},
"include": [
"src"
],
"compileOnSave": false
},
"errors": [],
"wildcardDirectories": {
"c:/users/ash/desktop/tmp-rollup-api-extrator/src": 1
},
"compileOnSave": false
}
rpt2: typescript version: 4.6.4
rpt2: tslib version: 2.4.0
rpt2: rollup version: 2.73.0
rpt2: rollup-plugin-typescript2 version: 0.31.2
rpt2: plugin options:
{
"clean": true,
"verbosity": 3,
"check": false,
"tsconfig": "C:\\Users\\ash\\Desktop\\tmp-rollup-api-extrator\\tsconfig.json",
"tsconfigOverride": {
"compilerOptions": {
"declaration": true,
"rootDir": "C:\\Users\\ash\\Desktop\\tmp-rollup-api-extrator"
}
},
"cacheRoot": "C:\\Users\\ash\\Desktop\\tmp-rollup-api-extrator\\node_modules\\.cache\\rollup-plugin-typescript2",
"include": [
"*.ts+(|x)",
"**/*.ts+(|x)"
],
"exclude": [
"*.d.ts",
"**/*.d.ts"
],
"abortOnError": true,
"rollupCommonJSResolveHack": false,
"useTsconfigDeclarationDir": false,
"transformers": [],
"tsconfigDefaults": {},
"objectHashIgnoreUnknownHack": false,
"cwd": "C:\\Users\\ash\\Desktop\\tmp-rollup-api-extrator",
"typescript": "version 4.6.4"
}
rpt2: rollup config:
{
"external": [
"vue"
],
"input": "src/index.ts",
"plugins": [
{
"name": "rpt2"
},
{
"name": "stdin"
}
],
"output": [
{
"file": "dist/index.js",
"format": "esm",
"globals": {
"vue": "Vue"
},
"plugins": []
}
]
}
rpt2: tsconfig path: C:/Users/ash/Desktop/tmp-rollup-api-extrator/tsconfig.json
rpt2: included:
[
"*.ts+(|x)",
"**/*.ts+(|x)"
]
rpt2: excluded:
[
"*.d.ts",
"**/*.d.ts"
]
rpt2: not cleaning C:\Users\ash\Desktop\tmp-rollup-api-extrator\node_modules\.cache\rollup-plugin-typescript2/placeholder
rpt2: �[34mtranspiling�[39m 'C:\Users\ash\Desktop\tmp-rollup-api-extrator\src\index.ts'
rpt2: �[34mgenerated declarations�[39m for 'C:/Users/ash/Desktop/tmp-rollup-api-extrator/src/index.ts'
rpt2: generating target 1
rpt2: �[34mrolling caches�[39m
rpt2: �[34memitting declarations�[39m for 'C:/Users/ash/Desktop/tmp-rollup-api-extrator/src/index.ts' to 'src/index.d.ts'
agilgur5 and liuliangsir
Metadata
Metadata
Assignees
Labels
kind: bugSomething isn't working properlySomething isn't working properlysolution: duplicateThis issue or pull request already existsThis issue or pull request already existstopic: TS Compiler API DocsRelated to the severely lacking TS Compiler API DocsRelated to the severely lacking TS Compiler API Docstopic: monorepo / symlinksRelated to monorepos and/or symlinks (Lerna, Yarn, PNPM, Rush, etc)Related to monorepos and/or symlinks (Lerna, Yarn, PNPM, Rush, etc)