grid-js / gridjs

Advanced table plugin
https://gridjs.io
MIT License
4.35k stars 237 forks source link

Type 'unknown' does not satisfy the constraint 'BaseProps" #673

Open ru-van-urk opened 3 years ago

ru-van-urk commented 3 years ago

Describe the bug When compiling my Ionic Angular app the app refuses to compile because of the following error:

image

We're using strict typechecking.

To Reproduce Steps to reproduce the behavior:

  1. Follow the guide on: https://gridjs.io/docs/integrations/angular
  2. Change import because of following error:
    image
  3. Save
  4. You'll get the error

Expected behavior My app to compile and run it with GridJs

Desktop (please complete the following information):

ravindrank commented 2 years ago

Any workarounds for this issue?

I read a similiar issue somewhere else https://githubmemory.com/repo/grid-js/gridjs-angular/issues/89

@TammyCT gridjs-angular does not export grid config type anymore, instead, it uses the one from gridjs package
import { UserConfig } from 'gridjs';
I will update the docs

I tried this but no change..

ravindrank commented 2 years ago

I was able to solve this... Doc page https://gridjs.io/docs/integrations/angular needs update

Correct lines below: import { GridJsAngularModule } from 'gridjs-angular'; edit line-> imports: [... GridJsAngularModule],

For this error:Error: node_modules/gridjs/dist/src/view/base.d.ts:5:67 - error TS2344: Type 'unknown' does not satisfy the constraint 'BaseProps'.5 export declare abstract class BaseComponent

extends Component<P, S> {

I changed the base.d.ts file :BaseProps = unknown to BaseProps = any.. This is a workaround and if install the package it will get overwritten so not a solution... Line as below:

export declare abstract class BaseComponent<P extends BaseProps = any, S = unknown> extends Component<P, S> {