10000 fix(volar/jsx-directive): prevent handle v-model's dynamic argument for component context by zhiyuanzmj · Pull Request #931 · vue-macros/vue-macros · GitHub
[go: up one dir, main page]

Skip to content

fix(volar/jsx-directive): prevent handle v-model's dynamic argument for component context #931

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

Merged
merged 4 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(jsx-directive)!: use v-slots instead of vSlots
  • Loading branch information
zhiyuanzmj committed Mar 13, 2025
commit 5158b497cd102904b8c5cd1cdfd536e61e5cc8d4
2 changes: 1 addition & 1 deletion packages/jsx-directive/src/core/v-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function transformVSlot(
Array.from(nodeMap)
.reverse()
.forEach(([node, { attributeMap, vSlotAttribute }]) => {
const result = [` vSlots={{`]
const result = [` v-slots={{`]
const attributes = Array.from(attributeMap)
attributes.forEach(
([attribute, { children, vIfAttribute, vForAttribute }], index) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/volar/src/jsx-directive/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export function resolveCtxMap(
): Map<import('typescript').Node, string> {
if (ctxNodeMap.size) {
options.codes.push(`
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
// @ts-ignore
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false; type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
type __VLS_Element = globalThis.JSX.Element;
function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
declare function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
T extends new (...args: any) => any
? (props: (K extends { $props: infer Props } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & { __ctx?: {
attrs?: any,
Expand All @@ -35,7 +35,7 @@ const __VLS_nativeElements = {
...{} as SVGElementTagNameMap,
...{} as HTMLElementTagNameMap,
};
function __VLS_getFunctionalComponentCtx<T, K, const S>(
declare function __VLS_getFunctionalComponentCtx<T, K, const S>(
comp: T,
compInstance: K,
s: S,
Expand All @@ -46,7 +46,7 @@ function __VLS_getFunctionalComponentCtx<T, K, const S>(
? Ctx
: never
: T extends (props: infer P, ctx: infer Ctx) => any
? { props: P; slots: P['vSlots']; expose: P['vExpose'] } & Ctx
? { props: P } & Ctx
: {};\n`)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/volar/src/jsx-directive/v-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function transformVSlot(
const { codes, ts, ast, source, prefix } = options

nodeMap.forEach(({ attributeMap, vSlotAttribute }, node) => {
const result: Code[] = [' vSlots={{']
const result: Code[] = [' v-slots={{']
const attributes = Array.from(attributeMap)
attributes.forEach(
([attribute, { children, vIfAttribute, vForAttribute }], index) => {
Expand Down
Loading
0