Skip to content

Commit 259eea1

Browse files
authored
revert: type support of slot children (#5137) (#5514)
1 parent 559c51e commit 259eea1

File tree

10 files changed

+0
-76
lines changed

10 files changed

+0
-76
lines changed

extensions/vscode/schemas/vue-tsconfig.schema.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@
4949
"default": false,
5050
"markdownDescription": "Enables strict templates. When set to `true`, all `checkUnknown*` options will be enabled."
5151
},
52-
"strictSlotChildren": {
53-
"type": "boolean",
54-
"default": false,
55-
"markdownDescription": "Strict type constraints of slot children. If not set, uses the 'strictTemplates' value."
56-
},
5752
"strictVModel": {
5853
"type": "boolean",
5954
"default": false,

packages/language-core/lib/codegen/globalTypes.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ export function generateGlobalTypes({
8787
expose?: (exposed: T) => void,
8888
}
8989
};
90-
type __VLS_NormalizeSlotReturns<S, R = NonNullable<S> extends (...args: any) => infer K ? K : any> = R extends any[] ? {
91-
[K in keyof R]: R[K] extends infer V
92-
? V extends Element ? V
93-
: V extends new (...args: any) => infer R ? ReturnType<__VLS_FunctionalComponent<R>>
94-
: V extends (...args: any) => infer R ? R
95-
: any
96-
: never
97-
} : R;
9890
type __VLS_IsFunction<T, K> = K extends keyof T
9991
? __VLS_IsAny<T[K]> extends false
10092
? unknown extends T[K]

packages/language-core/lib/codegen/template/context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ export function createTemplateCodegenContext(
213213
templateRefs,
214214
currentComponent: undefined as {
215215
ctxVar: string;
216-
childTypes: string[];
217216
used: boolean;
218217
} | undefined,
219218
singleRootElTypes: [] as string[],

packages/language-core/lib/codegen/template/element.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ export function* generateComponent(
4141
const componentCtxVar = ctx.getInternalVariable();
4242
const isComponentTag = node.tag.toLowerCase() === 'component';
4343

44-
ctx.currentComponent?.childTypes.push(`typeof ${componentVNodeVar}`);
4544
ctx.currentComponent = {
4645
ctxVar: componentCtxVar,
47-
childTypes: [],
4846
used: false,
4947
};
5048

@@ -305,8 +303,6 @@ export function* generateElement(
305303
: undefined;
306304
const failedPropExps: FailedPropExpression[] = [];
307305

308-
ctx.currentComponent?.childTypes.push(`__VLS_NativeElements['${node.tag}']`);
309-
310306
yield `__VLS_asFunctionalElement(__VLS_elements`;
311307
yield* generatePropertyAccess(
312308
options,

packages/language-core/lib/codegen/template/vSlot.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@ export function* generateVSlot(
7878
ctx.removeLocalVariable(varName);
7979
}
8080

81-
if (options.vueCompilerOptions.strictSlotChildren && node.children.length) {
82-
yield `(): __VLS_NormalizeSlotReturns<typeof ${slotVar}> => (`;
83-
yield* wrapWith(
84-
node.loc.start.offset,
85-
node.loc.end.offset,
86-
ctx.codeFeatures.verification,
87-
`{} as [`,
88-
...ctx.currentComponent.childTypes.map(name => `${name}, `),
89-
`]`,
90-
);
91-
yield `)${endOfLine}`;
92-
}
93-
9481
if (slotDir) {
9582
let isStatic = true;
9683
if (slotDir.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {

packages/language-core/lib/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export interface VueCompilerOptions {
3030
vitePressExtensions: string[];
3131
petiteVueExtensions: string[];
3232
jsxSlots: boolean;
33-
strictSlotChildren: boolean;
3433
strictVModel: boolean;
3534
strictCssModules: boolean;
3635
checkUnknownProps: boolean;

packages/language-core/lib/utils/ts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ export function getDefaultCompilerOptions(target = 99, lib = 'vue', strictTempla
293293
vitePressExtensions: [],
294294
petiteVueExtensions: [],
295295
jsxSlots: false,
296-
strictSlotChildren: strictTemplates,
297296
strictVModel: strictTemplates,
298297
strictCssModules: false,
299298
checkUnknownProps: strictTemplates,

test-workspace/tsc/passedFixtures/vue3_strictTemplate/slot-children/child.vue

Lines changed: 0 additions & 5 deletions
This file was deleted.

test-workspace/tsc/passedFixtures/vue3_strictTemplate/slot-children/main.vue

Lines changed: 0 additions & 28 deletions
This file was deleted.

test-workspace/tsc/passedFixtures/vue3_strictTemplate/slot-children/parent.vue

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)