Skip to content

TS2769: No overload matches this call. Default value props #482

@MatiKingloom

Description

@MatiKingloom

Hi, im using TSX with babel-preset-vca-jsx.
Since 0.6.7 im having a issue with typescript warning - TS2769: No overload matches this call.
Its about typescript does not count with not required props (have a default value).

TS2769: No overload matches this call.
  Overload 1 of 3, '(options?: ThisTypedComponentOptionsWithArrayProps<Vue, object, object, object, never> | undefined): object & Record<never, any> & ... 6 more ... & ExtractComputedReturns<...>', gave the following error.
    Type '{ request: { url: string; query: { tab: string; } | { tab?: undefined; }; }; loadingText: string; }' is not assignable to type 'Record<string, any> & Readonly<{ loadingText: string; request: IAjaxRequestParams; pageHasMenu: boolean; } & {}>'.
      Property 'pageHasMenu' is missing in type '{ request: { url: string; query: { tab: string; } | { tab?: undefined; }; }; loadingText: string; }' but required in type 'Readonly<{ loadingText: string; request: IAjaxRequestParams; pageHasMenu: boolean; } & {}>'.
  Overload 2 of 3, '(options?: ThisTypedComponentOptionsWithRecordProps<Vue, object, object, object, object> | undefined): object & Record<never, any> & ... 6 more ... & ExtractComputedReturns<...>', gave the following error.
    Type '{ request: { url: string; query: { tab: string; } | { tab?: undefined; }; }; loadingText: string; }' is not assignable to type 'Record<string, any> & Readonly<{ loadingText: string; request: IAjaxRequestParams; pageHasMenu: boolean; } & {}>'.
      Property 'pageHasMenu' is missing in type '{ request: { url: string; query: { tab: string; } | { tab?: undefined; }; }; loadingText: string; }' but required in type 'Readonly<{ loadingText: string; request: IAjaxRequestParams; pageHasMenu: boolean; } & {}>'.
  Overload 3 of 3, '(options?: ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>> | undefined): object & ... 7 more ... & ExtractComputedReturns<...>', gave the following error.
    Type '{ request: { url: string; query: { tab: string; } | { tab?: undefined; }; }; loadingText: string; }' is not assignable to type 'Record<string, any> & Readonly<{ loadingText: string; request: IAjaxRequestParams; pageHasMenu: boolean; } & {}>'.
      Property 'pageHasMenu' is missing in type '{ request: { url: string; query: { tab: string; } | { tab?: undefined; }; }; loadingText: string; }' but required in type 'Readonly<{ loadingText: string; request: IAjaxRequestParams; pageHasMenu: boolean; } & {}>'.

The component that i use has props:

    name: "AjaxContent",

    props: {
        pageHasMenu: {
            default: false,
            type: Boolean
        },

        loadingText: {
            default: "",
            type: String
        },

        request: {
            required: true,
            type: Object as PropType<IAjaxRequestParams>
        }
    },

The parent component that uses this AjaxContent component

<UiAjaxContent
    request={request.value}
    loadingText="Alamlehe laadimine"
    />

Since prop "pageHasMenu" is optional, it should be ok (it was ok before 0.6.7) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions