https://github.com/kazuma1989/repro-shallowequal-missing-types
https://github.com/kazuma1989/repro-shallowequal-missing-types
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kazuma1989/repro-shallowequal-missing-types
- Owner: kazuma1989
- Created: 2020-01-12T03:19:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-15T10:04:24.000Z (over 5 years ago)
- Last Synced: 2025-01-22T09:33:03.374Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Repro for an issue in @types/react-redux
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/41540
## Getting started
```zsh
npm install
npm run tsc
```Tsc is expected to throw an error, but it doesn't with `@types/[email protected]`.
## What is the problem?
```ts
type State = {
foo: string;
};// Expect error TS2322: Type 'string' is not assignable to type 'number'.
const foo: number = useSelector((state: State) => state.foo, shallowEqual);
```The return type of useSelector is expected to be string here, so it should be an error.
But the type definition for the shallowEqual misses type inference because it uses "any" for the parameter.```ts
export function shallowEqual(left: any, right: any): boolean;
```