question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.1.0 breaks TS build

See original GitHub issue

2.0.0 works great but once updated to 2.1.0 I got strange errors from ts compiler.

Type '{ type: string; required: string[]; properties: { firstName: { type: string; }; lastName: { type: string; }; email: { type: string; }; phone: { type: string[]; }; password: { type: string; }; participantId: { type: string; }; }; }' is not assignable to type 'ValidateFunction'.
  Type '{ type: string; required: string[]; properties: { firstName: { type: string; }; lastName: { type: string; }; email: { type: string; }; phone: { type: string[]; }; password: { type: string; }; participantId: { type: string; }; }; }' is not assignable to type 'JSONSchema7'.
    Types of property 'type' are incompatible.
      Type 'string' is not assignable to type '"string" | "number" | "boolean" | "object" | "integer" | "null" | "array" | JSONSchema7TypeName[]'.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
alexb-ukcommented, Oct 8, 2021

Adding as const did not fix the errors for me.

My error:

Error:(30, 14) TS2322: Type '{ type: string; properties: { mustHaveField: { type: string; }; }; required: string[]; }' is not assignable to type 'ValidateFunction'.
  Type '{ type: string; properties: { mustHaveField: { type: string; }; }; required: string[]; }' is not assignable to type 'JSONSchema7'.
    Types of property 'type' are incompatible.
      Type 'string' is not assignable to type 'JSONSchema7TypeName | JSONSchema7TypeName[]'.

Solution:

const schema: JSONSchema7 = {
  type: 'object',
  properties: {
    mustHaveField: { type: 'boolean' },
  },
  required: ['mustHaveField'],
};

Also updated to the latest json-schema type definition to avoid type mismatch error. At time of writing that’s "@types/json-schema": "^7.0.9",

HTH

1reaction
simonplendcommented, Aug 9, 2021

I’m planning to merge #89 tomorrow so that I can close this issue and get v2.2.0 released.

Thanks for your help everyone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Breaking change in 2.1.0 · Issue #200 · s-panferov ... - GitHub
Just ran a fresh travis build and something broke that we didn't change. ... In config/tsconfig.test.json we have a include to "typings/index.d.ts ......
Read more >
How to resolve compile errors during upgrade of Angular ...
I was able to fix the problem by upgrading some of the core dependencies manually like this: npm install --save @angular/animations@7 ...
Read more >
@nuxt/typescript-build | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
cron - npm
Versions and Backwards compatibility breaks: As goes with semver, breaking backwards compatibility should be explicit in the versioning of your ...
Read more >
Source build of jupyterlab 2.2.x failed with settingregistry.ts ...
The settingregistry.ts are the same between Build-1 and Build-2 (both version 2.2.5, 1167 lines). For completeness, here ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found