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: union func #59

Open tfs-tada opened 1 month ago

tfs-tada commented 1 month ago
type Props = { target: string };
type Action = Props | ((prevState: Props) => Props);
type Dispatch = (action: Action) => void;
const func: Dispatch = (prevState) => ({ target: "new" });
const newState = { hoge: "hoge" };
func({ target: "old", ...newState }); // エラーが出ない