language-server
language-server copied to clipboard
[Language Server] Importing a `type` from an external `*.marko` file from a `*.ts` file throws an error
@marko/[email protected]
Details
In VS Code, when importing a type definition from a package outside of the project, the Marko language server displays an error.
Using library-ts + eBay UI Core as an example:
/my-project/src/types/index.ts
import type { Input as EbayButton } from "@ebay/ebayui-core/dist/components/ebay-button/index.d.marko";
export type { EbayButton };
File '/my-project/node_modules/@ebay/ebayui-core/dist/components/ebay-button/index.d.marko' is not under 'rootDir' '/my-project/src'. 'rootDir' is expected to contain all source files.
Expected Behavior
No error is displayed.
Actual Behavior
An error is displayed (the path to the type declaration file is underlined in red).
Possible Fix
Additional Info
Your Environment
- Environment name and version (e.g. Chrome 39, node.js 5.4): Node.js 20.12.2
- Operating System and version (desktop or mobile): M1 MacBook Pro, Sonoma 14.5
- Link to your project: https://github.com/marko-js/examples/tree/master/examples/library-ts
Steps to Reproduce
- Clone
library-tsfrom https://github.com/marko-js/examples/tree/master/examples/library-ts -
npm install @ebay/ebayui-core - Create
src/types/index.ts - Add the code in the description above
Stack Trace
The file is in the program because:
Imported via "@ebay/ebayui-core/dist/components/ebay-button/index.d.marko" from file '/my-project/src/types/index.ts'
Imported via "./index.marko" from file '/my-project/node_modules/@ebay/ebayui-core/dist/components/ebay-button/component-browser.d.ts'
Root file specified for compilation ts(6059)