{"id":189,"hash":"1932690ac1a3c616aadda74dc42f9212a6443ed2e5be9ba65ec18701f7a0ad54","pattern":"What is &quot;not assignable to parameter of type never&quot; error in TypeScript?","full_message":"Code is:\n\nconst foo = (foo: string) => {\n  const result = []\n  result.push(foo)\n}\n\nI get the following TS error:\n\n[ts] Argument of type 'string' is not assignable to parameter of type 'never'.\n\nWhat am I doing wrong? Is this a bug?","ecosystem":"npm","package_name":"typescript","package_version":null,"solution":"All you have to do is define your result as a string array, like the following:  \n\nconst result : string[] = [];\n\nWithout defining the array type, it by default will be never. So when you tried to add a string to it, it was a type mismatch, and so it threw the error you saw.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/52423842/what-is-not-assignable-to-parameter-of-type-never-error-in-typescript","votes":905,"created_at":"2026-04-19T04:41:29.536217+00:00","updated_at":"2026-04-19T04:51:11.496013+00:00"}