structured-clone: [1.1.0] TS2345: Argument of type 'any' is not assignable to parameter of type 'never'

After upgrading to 1.1.0 it throws this error: TS2345: Argument of type 'any' is not assignable to parameter of type 'never'

On previous versions it worked just fine. Casting with as does not fix it.

Screenshot 2023-05-01 at 14 16 15

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 18 (16 by maintainers)

Most upvoted comments

@andrew-pyle it’s an Apollo cache query and the query: document has been generated by graphql-codegen.

Tomorrow I’ll create a codesandbox with a minimal repro.

This is the query just to get an idea:


const messages = client.readQuery({
        query: GetChatChannelMessagesDocument,
        variables: {
          chat_channel_id: channelId
        }
      });

OK, for the time being I have rolled back to any because there’s no solution and all negations around TS seem to be closed or not resolved or wont fix so until we have a way to say any BUT those-types which is also misleading as generic signature because the polyfill uses the native structuredClone behind the scene and there are no such limitations, I’m happy to Kepp It Simple.