Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win11 - Internal Error with Vite and TypeScript - "Unable to follow symbol for 'Promise'" Description #368

Closed
3 tasks done
Xtravaganz opened this issue Aug 9, 2024 · 2 comments · Fixed by #366
Closed
3 tasks done

Comments

@Xtravaganz
Copy link

Describe the bug

Note: Linux/Debian works (Docker tested) only Win11 has a problem.

I encountered an internal error while using Vite with TypeScript. The error message is as follows:

typescript - terminal message

[vite:dts] Internal Error: Unable to follow symbol for "Promise"

This issue occurs when attempting to initialize a promise within a function. The relevant code snippet is:

typescript - code

1

exampleFunction(input: Input, config: Config): Promise<ExampleClass> {
    
    let initConfig = extend(DEFAULTCONFIG, config);
    
    return new Promise<ExampleClass>((resolve, reject): void => {
    
        // some logic here
    });
}

2

exampleFunction(input: Input, config: Config): Promise<any> {
    
    let initConfig = extend(DEFAULTCONFIG, config);
    
    return new Promise<any>((resolve, reject): void => {
    
        // some logic here
    });
}

The error seems to originate from Vite's handling of TypeScript type declarations, particularly when dealing with the Promise type.

Reproduction

https://stackblitz.com/edit/stackblitz-starters-bmmh1n?file=api.ts

Steps to reproduce

Steps to Reproduce

Create a TypeScript project with Vite.
Implement a method that returns a Promise as shown in the code snippet above.
Run the Vite build or development server.

Expected Behavior

Vite should correctly process the TypeScript types without throwing an internal error related to the Promise symbol.
Actual Behavior

Vite throws an internal error, stating it is unable to follow the symbol for Promise.

System Info

## System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor             
    Memory: 29.95 GB / 63.92 GB
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527

## Environment:

    Vite Version: 5.2.12
    TypeScript Version: 5.4.5
    Operating System: Win11
    Node Version: 20.9.0

Validations

@Xtravaganz Xtravaganz changed the title Internal Error with Vite and TypeScript - "Unable to follow symbol for 'Promise'" Description Win11 - Internal Error with Vite and TypeScript - "Unable to follow symbol for 'Promise'" Description Aug 9, 2024
@SuperDJ
Copy link

SuperDJ commented Aug 12, 2024

Appears to be related to rollupTypes: true. Without it, it does work.

@guidsdo
Copy link

guidsdo commented Aug 13, 2024

Extra info: we found that this was only an issue on Windows, not Mac or Linux. It also only seems to be broken starting from version 4 of this library.

Extra error info:

Analysis will use the bundled TypeScript version 5.4.2
*** The target project appears to use TypeScript 5.5.4 which is newer than the bundled compiler engine; consider upgrading API Extractor.
x Build failed in 18.79s
error during build:
[vite:dts] Internal Error: Unable to follow symbol for "Promise"

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
    at AstSymbolTable._analyzeChildTree (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:328:43)
    at AstSymbolTable._analyzeChildTree (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:377:18)
    at AstSymbolTable._analyzeChildTree (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:377:18)
    at AstSymbolTable._analyzeChildTree (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:377:18)
    at AstSymbolTable._analyzeAstSymbol (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:247:18)
    at C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:259:34
    at AstDeclaration.forEachDeclarationRecursive (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstDeclaration.js:168:9)
    at AstSymbol.forEachDeclarationRecursive (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbol.js:103:28)
    at AstSymbolTable._analyzeAstSymbol (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:254:27)
    at AstSymbolTable.analyze (C:\project\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@microsoft\api-extractor\lib\analyzer\AstSymbolTable.js:113:25)
 ELIFECYCLE  Command failed with exit code 1.

@qmhc qmhc linked a pull request Aug 14, 2024 that will close this issue
@qmhc qmhc closed this as completed in #366 Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants