Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types of property 'serialize' are incompatible #235

Open
pszalanski opened this issue Feb 27, 2023 · 2 comments
Open

Types of property 'serialize' are incompatible #235

pszalanski opened this issue Feb 27, 2023 · 2 comments

Comments

@pszalanski
Copy link

I am getting an error after setting up query parameter bindings:

Types of property 'serialize' are incompatible.
    Type 'ParamSerializer<string | null>' is not assignable to type 'ParamSerializer<unknown>'.
      Type 'unknown' is not assignable to type 'string | null'.

21                  [queryParam]="searchParam">
                     ~~~~~~~~~~

  src/app/pages/component.ts:11:16
    11   templateUrl: './component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component Component.

This is the setup of the parameter:

class Component {
  searchParam: QueryParam<string>;

  constructor() {
    this.searchParam = qb.stringParam('search');
  }

I followed the example in the documentation.

My node_modules:

+-- __ngcc_entry_points__.json@ extraneous
+-- @angular-builders/[email protected]
+-- @angular-devkit/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @azure/[email protected]
+-- @azure/[email protected]
+-- @ngneat/[email protected]
+-- @ngneat/[email protected]
+-- @ngneat/[email protected]
+-- @ngqp/[email protected]
+-- @testing-library/[email protected]
+-- @testing-library/[email protected]
+-- @testing-library/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- @types/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
@Airblader
Copy link
Collaborator

It's possible that this has to do with Angular's recent typing improvements; as a workaround, can you try to use QueryParamGroup instead of binding a standalone param?

@pszalanski
Copy link
Author

Then I get this:

this.searchGroup.add('firmware_name', this.firmwareNameParam);

The error:

TS2345: Argument of type 'QueryParam<string>' is not assignable to parameter of type 'QueryParam<unknown> | MultiQueryParam<unknown> | PartitionedQueryParam<unknown, unknown[]>'.   
Type 'QueryParam<string>' is not assignable to type 'QueryParam<unknown>'.     
Types of property 'serialize' are incompatible.      
 Type 'ParamSerializer<string | null>' is not assignable to type 'ParamSerializer<unknown>'.        
 Type 'unknown' is not assignable to type 'string | null'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants