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

feat(types): simplify ExtractPropTypes to avoid props JSDocs being removed #5166

Merged
merged 3 commits into from
Dec 25, 2021
Merged

feat(types): simplify ExtractPropTypes to avoid props JSDocs being removed #5166

merged 3 commits into from
Dec 25, 2021

Conversation

johnsoncodehk
Copy link
Member

@johnsoncodehk johnsoncodehk commented Dec 24, 2021

Relate issues: vuejs/language-tools#799, microsoft/TypeScript#31992

Remove O extends object from ExtractPropTypes to avoid tsc remove props JSDoc comments.
And it can also help for improve component props hover info in IDE.

In addition, changed { [K in KeysType]: T[K] } to { [K in keyof Pick<K, KeysType>]: T[K] } to fixed find references, renaming not working for props again. (#3656)
Revert this change from LooseRequired because it cause tests failed.

Before simplify ExtractPropTypes:

import { PropType } from 'vue';
declare const _default: import("vue").DefineComponent<{
    /**
     * The icon name as per the reference at https://pepicons.com
     * @type {'airplane' | 'angle-down'}
     * @example 'airplane'
     */
    name: {
        type: PropType<Pepicon>;
        required: true;
    };
}, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
    name?: unknown;
} & {
    name: Pepicon;
} & {}>, {}>;
export default _default;

After simplify ExtractPropTypes:

import { PropType } from 'vue';
declare const _default: import("vue").DefineComponent<{
    /**
     * The icon name as per the reference at https://pepicons.com
     * @type {'airplane' | 'angle-down'}
     * @example 'airplane'
     */
    name: {
        type: PropType<Pepicon>;
        required: true;
    };
}, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
    /**
     * The icon name as per the reference at https://pepicons.com
     * @type {'airplane' | 'angle-down'}
     * @example 'airplane'
     */
    name: {
        type: PropType<Pepicon>;
        required: true;
    };
}>>, {}>;
export default _default;

@johnsoncodehk johnsoncodehk marked this pull request as ready for review December 24, 2021 16:39
@yyx990803 yyx990803 merged commit a570b38 into vuejs:master Dec 25, 2021
johnsoncodehk added a commit to vuejs/language-tools that referenced this pull request Dec 26, 2021
@mesqueeb
Copy link

mesqueeb commented Jan 9, 2022

@knightly-bot build this

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 this pull request may close these issues.

3 participants