错误: `TypeOrValueSpecifier` 不匹配工作区包中的类型

作者: simon-v-swyftx创建于 2024年9月23日更新于 2026年9月30日
标签bugaccepting prspackage: type-utils

Before You File a Bug Report Please Confirm You Have Done The Following... - [X] I have tried restarting my IDE and the issue persists. - [X] I have updated to the latest version of the packages. - [X] I have searched for related issues and found none that matched my issue. - [X] I have read the FAQ and my problem is not listed. ### Issue Description I was using the new allow option for restrict-template-expressions that landed in 8.6.0 I expected that: // packages/flat-config-typed-tsconfig/src/index.ts import { Uuid } from '@company/core' export class Service { public createPosition( id: Uuid ): void { // Invalid type "Uuid" of template literal expression const a = someUrl/${id}; // ^ specifically not working when specifying package: @company/core } } does not report @TypeScript-eslint/restrict-template-expressions with the following config: "@TypeScript-eslint/restrict-template-expressions": [ "error", { allow: [ // doesn't appear to be working { from: "package", name: "Uuid", package: "@company/core", } ] } ] The uuid file in question exports a class with a custom .toString so I don't want it to error See reproduction repo Feels related to this old fix: https://GitHub.com/TypeScript-eslint/TypeScript-eslint/pull/6780 but I might be barking up the wrong tree ### Reproduction Repository Link https://GitHub.com/simon-v-swyftx/TypeScript-eslint-reproducable ### Repro Steps 1) clone the repo 2) yarn install 3) view packages/flat-config-typed-tsconfig/src/index.ts 4) observe error on line 8 ### Versions | package | version | -------------------------------------- | ------- | @TypeScript-eslint/eslint-plugin | 8.6.0 @TypeScript-eslint/parser | 8.6.0 @TypeScript-eslint/scope-manager | 8.6.0 @TypeScript-eslint/TypeScript-estree | 8.6.0 @TypeScript-eslint/type-utils | 8.6.0 @TypeScript-eslint/utils | 8.6.0 TypeScript | 5.6.2 ESLint | 9.11.0 node | 20.10.0 |

内容来源: typescript-eslint/typescript-eslint