cypress-io / schema-tools

Validate, sanitize and document JSON schemas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix type errors that happens when matching up dependency versions with cypress.

sainthkh opened this issue ยท comments

When we update typescript version to 3.5.3 and @types/ramda to 0.25.47 which are used in cypress, there are a few type errors like these.

src/api.ts:449:9 - error TS2769: No overload matches this call.
  Overload 1 of 6, '(fn: (x: BindOptions) => CustomFormats | undefined, list: readonly BindOptions[]): (CustomFormats | undefined)[]', gave the following error.
    Argument of type '<T>(obj: Record<"formats", T>) => T' is not assignable to parameter of type '(x: BindOptions) => CustomFormats | undefined'.
      Types of parameters 'obj' and 'x' are incompatible.
        Type 'BindOptions' is not assignable to type 'Record<"formats", CustomFormats | undefined>'.
          Property 'formats' is optional in type 'BindOptions' but required in type 'Record<"formats", CustomFormats | undefined>'.
  Overload 2 of 6, '(fn: (x: number | BindOptions | (() => string) | { (...items: ConcatArray<BindOptions>[]): BindOptions[]; (...items: (BindOptions | ConcatArray<BindOptions>)[]): BindOptions[]; } | ... 17 more ... | (() => IterableIterator<...>)) => any, list: BindOptions[]): readonly any[]', gave the following error.
    Argument of type '<T>(obj: Record<"formats", T>) => T' is not assignable to parameter of type '(x: number | BindOptions | (() => string) | { (...items: ConcatArray<BindOptions>[]): BindOptions[]; (...items: (BindOptions | ConcatArray<BindOptions>)[]): BindOptions[]; } | ... 17 more ... | (() => IterableIterator<...>)) => any'.
      Types of parameters 'obj' and 'x' are incompatible.
        Type 'number | BindOptions | (() => string) | { (...items: ConcatArray<BindOptions>[]): BindOptions[]; (...items: (BindOptions | ConcatArray<BindOptions>)[]): BindOptions[]; } | ... 17 more ... | (() => IterableIterator<...>)' is not assignable to type 'Record<"formats", CustomFormats | undefined>'.
          Type 'number' is not assignable to type 'Record<"formats", CustomFormats | undefined>'.
  Overload 3 of 6, '(fn: (x: BindOptions) => CustomFormats | undefined, obj: Functor<BindOptions>): Functor<CustomFormats | undefined>', gave the following error.
    Argument of type '<T>(obj: Record<"formats", T>) => T' is not assignable to parameter of type '(x: BindOptions) => CustomFormats | undefined'.
      Types of parameters 'obj' and 'x' are incompatible.
        Type 'BindOptions' is not assignable to type 'Record<"formats", CustomFormats | undefined>'.

449     map(prop('formats'), options),
            ~~~~~~~~~~~~~~~


src/fill.ts:32:7 - error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'readonly string[]'.
  Type 'string | number' is not assignable to type 'string'.
    Type 'number' is not assignable to type 'string'.

32       missingProperties,
         ~~~~~~~~~~~~~~~~~

src/trim.ts:25:13 - error TS2322: Type 'PlainObject' is not assignable to type 'never'.

25             trimmedObj[prop] = trimBySchema(schema[prop], object[prop])
               ~~~~~~~~~~~~~~~~

src/trim.ts:27:13 - error TS2322: Type 'PlainObject[]' is not assignable to type 'never'.

27             trimmedObj[prop] = map(trimBySchema(schema[prop]), object[prop])

๐ŸŽ‰ This issue has been resolved in version 4.7.2 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€