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

angular 14.2 (and typescript 4.8.x) - schema-validator.service.ts (and ngx-charts) #931

Closed
PhilFlash opened this issue Nov 6, 2022 · 0 comments · Fixed by #932
Closed

Comments

@PhilFlash
Copy link
Contributor

I try to update ngx-charts for angular 14.2 (and typescript 4.8.4).
When I compile ngx-charts, I have an error with ngx-ui:

Error: node_modules/@swimlane/ngx-ui/lib/components/json-editor/schema-validator.service.d.ts:4:10 - error TS2702: 'Ajv' only refers to a type, 
but is being used as a namespace here.
4     ajv: Ajv.Ajv;

If i patch node_modules@swimlane\ngx-ui\lib\components\json-editor\schema-validator.service.d.ts with:
BEFORE: export declare class SchemaValidatorService { ajv: Ajv.Ajv;
AFTER: export declare class SchemaValidatorService { ajv: Ajv;
all is ok.

With this error, it is not possible to post a pull request for ngx-charts for angular 14.2.

Is-it possible to change the code for ngx-ui/projects/swimlane/ngx-ui/src/lib/components/json-editor/schema-validator.service.ts
like this (for all typescript version) => declare variable with constructor
BEFORE:

export class SchemaValidatorService {
  ajv: Ajv.Ajv;

  constructor() {
    this.ajv = new Ajv({
      allErrors: true
    });
    this.ajv.addFormat('password', '.*');
    this.ajv.addFormat('code', '.*');
    this.ajv.addFormat('binary', '.*');
  }

AFTER:

export class SchemaValidatorService {
  ajv = new Ajv({
      allErrors: true
    });

  constructor() {
    this.ajv.addFormat('password', '.*');
    this.ajv.addFormat('code', '.*');
    this.ajv.addFormat('binary', '.*');
  }

Philippe

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

Successfully merging a pull request may close this issue.

1 participant