Back to the Seattle Mariners Newsfeed

Argument of type not assignable to parameter type 'never' | bobbyhadz (2024)

This article covers 3 errors, so make sure to click on the relevant to yousubheading depending on if you use TypeScript or React.js.

# Argument of type not assignable to parameter type 'never'

The error "Argument of type is not assignable to parameter of type 'never'"occurs when we declare an empty array without explicitly typing it and attemptto add elements to it.

To solve the error, explicitly type the empty array, e.g.const arr: string[] = [];.

Here are 2 examples of how the error occurs.

index.ts

Copied!