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

fix(language-core): should not make $props optional #4878

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

KazariEX
Copy link
Collaborator

fix #4876

@KazariEX KazariEX changed the title fix(language-core): should not make $props optional fix(language-core): should not make $props optional Sep 25, 2024
Copy link

pkg-pr-new bot commented Sep 25, 2024

Open in Stackblitz

vue-component-meta

pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-meta@4878

@vue/language-plugin-pug

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@4878

@vue/language-core

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-core@4878

@vue/language-server

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-server@4878

vue-component-type-helpers

pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@4878

@vue/language-service

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-service@4878

vue-tsc

pnpm add https://pkg.pr.new/vuejs/language-tools/vue-tsc@4878

@vue/typescript-plugin

pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@4878

commit: 3557d8b

davidmatter
davidmatter previously approved these changes Sep 25, 2024
Copy link
Collaborator

@davidmatter davidmatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KazariEX KazariEX enabled auto-merge (squash) September 25, 2024 09:24
Comment on lines -56 to +55
yield `$props: __VLS_makeOptional(${scriptSetupRanges.props.name ?? `__VLS_props`}),${newLine}`;
yield `$props: ${scriptSetupRanges.props.name ?? `__VLS_props`},${newLine}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is correct in general.

Try with a component with props:

  msg: {
    type: String,
    default: null
  }

In that case the prop should be optional but won't.

I feel like that might need coordination with changes in Vue types.

Copy link
Member

@johnsoncodehk johnsoncodehk Oct 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just add a test case in 3557d8b (#4878) for this.

@rchl rchl disabled auto-merge October 7, 2024 09:24
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.

JS defineProps() does not mark props as required
4 participants