vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.82k stars 396 forks source link

Vue TSC enums being reduced to never, Webstorm/VSCode not picking up these errors #3853

Closed stichingsd-vitrion closed 2 months ago

stichingsd-vitrion commented 9 months ago

Vue TSC enums being reduced to never, Webstorm/VSCode not picking up these errors

cms:typecheck:   The intersection 'typeof MutationTypeEnum & { readonly [x: number]: string; readonly CREATED: MutationTypeEnum.CREATED; readonly UPDATED: MutationTypeEnum.UPDATED; readonly DELETED: MutationTypeEnum.DELETED; }' was reduced to 'never' because property 'CREATED' has conflicting types in some constituents.
cms:typecheck: ../../node_modules/lib/src/components/Features/casefiles/edit/activities/ActivityItem/ActivityItem.vue(51,36): error TS2322: Type '(InternalHydraItem & HydraTimeBased & { '@type': "Activity"; id: number; createdBy: UserHydraItem; type?: ActivityTypeEnum | undefined; caseFile: string; mutationType?: MutationTypeEnum | undefined; } & ActivityCreated) | (InternalHydraItem & ... 2 more ... & ActivityCaseFileUpdated) | (InternalHydraItem & ... 2 mor...' is not assignable to type 'InternalHydraItem & HydraTimeBased & { '@type': "Activity"; id: number; createdBy: UserHydraItem; type?: ActivityTypeEnum | undefined; caseFile: string; mutationType?: MutationTypeEnum | undefined; } & ActivityCaseFileUpdated'.
cms:typecheck: ../../node_modules/lib/src/components/Features/casefiles/edit/activities/ActivityItem/ActivityItem.vue(60,47): error TS2339: Property 'PAYMENT' does not exist on type 'never'.

We are running:

"vue-tsc": "^1.8.25"
"vite": "^5.0.10",
"typescript": "^5.2.2",
"vue": "^3.4.0",

Is there a way to fix this? We tried many many things but at the end we ended up just replacing value's of enums with their actual values.

Example enum:

export enum MutationTypeEnum {
  CREATED = 1,
  UPDATED = 2,
  DELETED = 3,
}

image As the image above shows we needed to replace all ENUM values with the actual values because we kept getting errors

so1ve commented 9 months ago

I can't reproduce. Could you please create a minimal reproduction?

davidmatter commented 2 months ago

Closing this one as many things have changed since 2.x. Feel free to create a new issue with a minimal reproduction if you're still having issues, thanks!