score:0
your biggest issue here is that you are specifying the type any
everywhere, which defeats the point of typescript and won't help you learn.
you need to set the return type on the function as typescript is inferring its type from the first value you are returning in the tuple.
if you tell typescript what to expect it won't infer anything.
you can define a tuple in the same shape as you want the return:
type storereturn = [((store: any) => any) | undefined, (action: any) => {}, () => {}];
then when you define the function you specify the return type
const createstore = (initialstore: any): storereturn => {
// your code
}
doing this in your sandbox got the correct result for me. typescript has incredible documentation and i encourage you to give it a go. a good practice for me was to set strict rules in tsconfig to not allow the use of any
like this.
Source: stackoverflow.com
Related Query
- Typescript returning error Argument of type is not assignable but it seems like it is confusing one function for another
- Argument of type is not assignable to parameter of type Typescript Error
- How to fix the error argument of type string or undefined is not assignable to parameter of type string using typescript and react?
- Typescript error on React Component: Argument of type 'Element' is not assignable to parameter of type
- TypeScript error Argument of type is not assignable to parameter of type Appstate despite having all necessary types included
- TypeScript Error (TS2345) argument of type Person | undefined is not assignable to paramater of type Person
- TypeScript Error Argument of type '{}' is not assignable to parameter of type 'Variable Y'
- How to fix error argument of type undefined is not assignable to parameter of type 'string or () => string usng typescript and react?
- React Typescript - Argument of type is not assignable to parameter of type
- getting error : Argument of type '() => () => boolean' is not assignable to parameter of type 'EffectCallback'
- Typescript React/Redux : Argument of type 'typeof MyClass' is not assignable to parameter of type 'ComponentType<...'
- React + Redux-Observable + Typescript - Compilation, Argument Not Assignable Error
- CombineReducers with Typescript returns error "Argument of type is not assignable to parameter of type 'ReducersMapObject'"
- React Typescript error in TextArea : Type 'string' is not assignable to type number
- Getting an error Argument of type 'unknown' is not assignable to parameter of type 'Error | null'
- Creating reusable Button Component with React and Typescript with not assignable type error
- React js Typescript Argument of type 'string' is not assignable to parameter of type 'SetStateAction<number>'
- Typescript returns error when a function type is FunctionalComponent, but not for arrow function
- Typescript error 'argument of type is not assignable to parameter of type'
- TypeScript error : Type '.....' is not assignable to type 'IntrinsicAttributes & Number'
- TypeScript w/ React - Argument of type 'string' is not assignable to parameter of type 'keyof T'
- Using state and includes in React gives Argument of type 'number' is not assignable to parameter of type 'never' error
- Argument of type 'never[]' is not assignable to parameter of type 'never' when declaring a type in Typescript
- Withrouter Error using function component and typescript jsx.element' is not assignable to parameter of type routecomponentprops
- Typescript Error: Argument of type 'NodeListOf<HTMLInputElement> | undefined' is not assignable to parameter of type 'Iterable<HTMLInputElement> ..."
- Stateful Component with Typescript and react-redux: Argument of type 'typeof MyClass' is not assignable to parameter of type Component
- React Typescript error Type '{ id: number; title: string; function(): void; }' is not assignable to type 'null'
- Cryptic Typescript compiler error using React: 'ComponentClass<StyledComponentProps<{}>>' is not assignable to type 'typeof MyComponent'
- Error argument of type 'Item' is not assignable to parameter of type 'string'. TS2345
- getting error :Type '[null, Dispatch<SetStateAction<null>>]' is not assignable to type in typescript react
More Query from same tag
- React.js - componentWillReceiveProps being hit twice
- React Component - set page title
- React: update one item in a list without recreating all items
- ReactJS ProtectedRoute redirects. Variable rendered twice, false on the first time yet its true in the redux-store
- Why Home.js and Cards.js are called many time?
- Inline styles in react doesnt work in print mode
- Flow React: Cannot create element because React.Component [1] is not a React component
- React: Why component's constructor is called only once?
- React Router Dom NavLink and Link not Working
- Passing a prop to a child created after component mounts
- React admin access datagrid row value
- Sending an array to Micronaut Graphql for query from ReactJS
- Material ui table not updating
- How to update react context in child elements
- React Bind to const outside Class
- Format date in react.js from data in api url
- How to integrate Javascript variable into ReactJS JSX style element
- react router, nginx, node, static files
- How to to setState in a loop?
- React efficient way to bind event to many dom elements
- Property 'RocketChat' does not exist on type 'Window'
- Selecting all text inside react-bootstrap-typeahead on inner input focus
- jest + enyzme + useRef
- Passed function as prop and is undefined
- Nodejs - TypeError stating that the hashPassword function is not a function, how can I solve it?
- How to use <Trans /> of react-i18next for an alt image translation?
- Update element on updating react state array
- How do you pass an onClick function to grandchild component in React?
- Need react context to update before redirect
- Component does not change state when going from dynamic route to static