Skip to content

Code needs some updates to compile with never typescript versions (TS2322) #140

@marcdumais-work

Description

@marcdumais-work

Bug Description:

The errors below were seen when typescript was updated to the latest v5.x:

tsp-typescript-client: 
tsp-typescript-client: tsp-typescript-client: $ tsc
Error: tsp-typescript-client: src/protocol/serialization.ts(153,19): error TS2322: Type 'any[]' is not assignable to type 'T'.
tsp-typescript-client:   'T' could be instantiated with an arbitrary type which could be unrelated to 'any[]'.
Error: tsp-typescript-client: src/protocol/serialization.ts(169,11): error TS2322: Type 'Deserialized<T> & {}' is not assignable to type 'T'.
tsp-typescript-client:   'T' could be instantiated with an arbitrary type which could be unrelated to 'Deserialized<T> & {}'.
tsp-typescript-client: 
tsp-typescript-client: tsp-typescript-client: error Command failed with exit code 2.

Seems related to microsoft/TypeScript#56941.

Reading quickly it seems that TypeScript, starting around v5.8.x, became more strict about generic types used in return statements. I think that fixing this would entail making a couple of return types "tighter" to satisfy the new check.

Steps to Reproduce:

  1. Update the version range for dependency typescript to the latest v5.x
  2. try to build
  3. see if you get typescript error TS2322

Additional Information

  • Operating System:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions