Subscribe on changes!

`@vue/compiler-core` import `@babel/types` in type definition but missing in dependencies

avatar
Oct 16th 2022

Vue version

3.2.41

Link to minimal reproduction

https://github.com/trim21/vue-compile-core-missing-deps

there is a vue type shim

declare module '*.vue' {
  import type { DefineComponent } from "vue";
  const component: DefineComponent<{}, {}, any>;
  export default component;
}

Steps to reproduce

git clone https://github.com/trim21/vue-compile-core-missing-deps
cd vue-compile-core-missing-deps
npm i
npx tsc --noEmit

What is expected?

tsc type checking ok

What is actually happening?

[00:45:25] Starting compilation in watch mode...

node_modules/@babel/parser/typings/babel-parser.d.ts:14:23 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

14 ): ParseResult<import("@babel/types").File>;
                         ~~~~~~~~~~~~~~

node_modules/@babel/parser/typings/babel-parser.d.ts:22:23 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

22 ): ParseResult<import("@babel/types").Expression>;
                         ~~~~~~~~~~~~~~

node_modules/@vue/compiler-core/dist/compiler-core.d.ts:1:57 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

1 import type { BlockStatement as BlockStatement_2 } from '@babel/types';
                                                          ~~~~~~~~~~~~~~

node_modules/@vue/compiler-core/dist/compiler-core.d.ts:2:45 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

2 import type { Function as Function_2 } from '@babel/types';
                                              ~~~~~~~~~~~~~~

node_modules/@vue/compiler-core/dist/compiler-core.d.ts:4:33 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

4 import type { Identifier } from '@babel/types';
                                  ~~~~~~~~~~~~~~

node_modules/@vue/compiler-core/dist/compiler-core.d.ts:5:37 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

5 import type { Node as Node_3 } from '@babel/types';
                                      ~~~~~~~~~~~~~~

node_modules/@vue/compiler-core/dist/compiler-core.d.ts:6:37 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

6 import type { ObjectProperty } from '@babel/types';
                                      ~~~~~~~~~~~~~~

node_modules/@vue/compiler-core/dist/compiler-core.d.ts:8:30 - error TS2307: Cannot find module '@babel/types' or its corresponding type declarations.

8 import type { Program } from '@babel/types';
                               ~~~~~~~~~~~~~~

[00:45:27] Found 8 errors. Watching for file changes.

System Info

doesn't matter

Any additional comments?

This is fixed with @babel/types in deps.

avatar
Oct 16th 2022

It's by design I think. If you need TypeScript support then install it by yourself.


You can enable skipLibCheck in tsconfig