Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/vue-language-core/src/utils/localTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export type EmitEvent<F, E> =
export declare function asFunctionalComponent<T, K>(t: T, instance?: K):
T extends (...args: any) => any ? T
: K extends { $props?: infer Props, $slots?: infer Slots, $emit?: infer Emit }
? (props: Props, ctx?: { attrs?: any, expose?: any, slots?: Slots, emit?: Emit }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props }
? (props: Props, ctx?: { attrs?: any, expose?: any, slots?: Slots, emit?: Emit }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props }
: (_: T) => { __ctx?: { attrs?: undefined, expose?: undefined, slots?: undefined, emit?: undefined }, __props?: T }; // IntrinsicElement
export declare function pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): FillingEventArg<
PickNotAny<
Expand Down
31 changes: 31 additions & 0 deletions packages/vue-tsc/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,34 @@ describe(`vue-tsc`, () => {
});
}), 40_000);
});


describe(`vue-tsc vue 2`, () => {
it(`vue-tsc no errors`, () => new Promise((resolve, reject) => {
const cp = fork(
binPath,
['--noEmit'],
{
silent: true,
cwd: path.resolve(__dirname, '../../vue2-test-workspace/vue-tsc')
},
);

cp.stdout?.setEncoding('utf8');
cp.stdout?.on('data', (data) => {
console.log(data);
});
cp.stderr?.setEncoding('utf8');
cp.stderr?.on('data', (data) => {
console.error(data);
});

cp.on('exit', (code) => {
if (code === 0) {
resolve(undefined);
} else {
reject(new Error(`Exited with code ${code}`));
}
});
}), 40_000);
});
21 changes: 21 additions & 0 deletions packages/vue2-test-workspace/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021-present Johnson Chu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions packages/vue2-test-workspace/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"private": true,
"name": "@volar/vue-test-workspace",
"version": "1.3.11",
"license": "MIT",
"devDependencies": {
"vue": "2.7.14"
}
}
27 changes: 27 additions & 0 deletions packages/vue2-test-workspace/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"lib": [
"esnext",
"dom"
],
"strict": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"allowJs": true,
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"__COMPLETE_ROOT__/*": [
"./complete/*"
],
"__FIND_DEFINITION_ROOT__/*": [
"./find-definition/*"
]
}
},
"include": [
"**/*"
]
}
7 changes: 7 additions & 0 deletions packages/vue2-test-workspace/vue-tsc/components/main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script lang="tsx">
import Vue from 'vue'

export default Vue.extend({

})
</script>
10 changes: 10 additions & 0 deletions packages/vue2-test-workspace/vue-tsc/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// https://stackoverflow.com/a/53808212
type IfEquals<T, U, Y = unknown, N = never> =
(<G>() => G extends T ? 1 : 2) extends
(<G>() => G extends U ? 1 : 2) ? Y : N;
export declare function exactType<T, U>(draft: T & IfEquals<T, U>, expected: U & IfEquals<T, U>): IfEquals<T, U>;

// https://stackoverflow.com/a/49928360
type IfNotAny<T> = 0 extends 1 & T ? never : T;
type IfNotUndefined<T> = Exclude<T, undefined> extends never ? never : T;
export declare function isNotAnyOrUndefined<T>(value: IfNotAny<IfNotUndefined<T>>): void;
15 changes: 15 additions & 0 deletions packages/vue2-test-workspace/vue-tsc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
"noPropertyAccessFromIndexSignature": true,
},
"vueCompilerOptions": {
"target": 2.7
},
"include": [
"**/*.ts",
"**/*.vue",
"**/*.html",
]
}
Loading