-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
types(slots): Add typed slots #2693
Conversation
# Conflicts: # packages/runtime-core/src/componentOptions.ts
# Conflicts: # packages/runtime-core/src/componentOptions.ts
Since in Volar 0.34.0, original typed slot support has been removed because of performance reason, could we move this PR forward. I feel this is the last piece of Vue TypeScript tooling support. It's a big pain for any large scale Vue project. |
# Conflicts: # packages/compiler-sfc/src/cssVars.ts # packages/dts-test/defineComponent.test-d.tsx # packages/runtime-core/src/apiDefineComponent.ts # packages/runtime-core/src/component.ts # packages/runtime-core/src/componentOptions.ts # packages/runtime-core/src/componentPublicInstance.ts # packages/runtime-core/src/scheduler.ts
// TODO review this part | ||
if (slotsTypeDecl) { | ||
const content = slotsTypeDecl.__fromNormalScript | ||
? script!.content | ||
: scriptSetup.content | ||
args += `: { slots: (${content.slice( | ||
slotsTypeDecl.start!, | ||
slotsTypeDecl.end! | ||
)}), expose: any, emit: any, attrs: any }` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this, this seems that might cause an issue when we have both slot and emit
@yyx990803 Do you mind reviewing this PR? I need some help on the compiler macro for
and #2693 (comment) |
slots: null as unknown as { | ||
default: { | ||
Component: ComponentPublicInstance | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict behaviour by default, this behaviour is a breaking change, I can make it less strict if needed
Very grateful for your PR. I didn't even notice this PR before #7982. So I close this. |
Allow type slots: vuejs/rfcs#192