tfs-tada / eslint-plugin-no-excess-property

ESLint plugin to prevent excess properties in TypeScript objects, ensuring strict adherence to type definitions.
https://www.npmjs.com/package/eslint-plugin-no-excess-property?activeTab=readme
MIT License
3 stars 0 forks source link

fix: generics union #27

Open tfs-tada opened 5 months ago

tfs-tada commented 5 months ago
type Human<T> = { body: T; isHuman: true };
type Robot<T> = { body: T; isHuman: false; uuid: string };
type User<T> = Human<T> | Robot<T>;
const jiro = { body: { name: "jiro" }, isHuman: true, uuid: "123" } as const;
const user: User<{ name: string }> = jiro;