-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
367 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
defineComponent((_, ctx: SetupContext<(e: 'foo' | 'bar') => void>) => {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
defineComponent((_, ctx: SetupContext<(e: 'foo' | 'bar') => void>)=>{}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/exported-interface/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
5 changes: 5 additions & 0 deletions
5
visitor/tests/fixture/resolve-emits-types/exported-interface/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
export interface Emits { (e: 'foo' | 'bar'): void } | ||
|
||
defineComponent((_, ctx: SetupContext<Emits>) => {}) |
10 changes: 10 additions & 0 deletions
10
visitor/tests/fixture/resolve-emits-types/exported-interface/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
export interface Emits { | ||
(e: 'foo' | 'bar') : void; | ||
} | ||
defineComponent((_, ctx: SetupContext<Emits>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/exported-type-alias/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
5 changes: 5 additions & 0 deletions
5
visitor/tests/fixture/resolve-emits-types/exported-type-alias/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
export type Emits = { (e: 'foo' | 'bar'): void } | ||
|
||
defineComponent((_, ctx: SetupContext<Emits>) => {}) |
10 changes: 10 additions & 0 deletions
10
visitor/tests/fixture/resolve-emits-types/exported-type-alias/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
export type Emits = { | ||
(e: 'foo' | 'bar') : void; | ||
}; | ||
defineComponent((_, ctx: SetupContext<Emits>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/fn-type/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
defineComponent((_, ctx: SetupContext<(e: 'foo' | 'bar') => void>) => {}) | ||
|
||
defineComponent((_, ctx: SetupContext<((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void)>) => {}) | ||
|
||
defineComponent((_, ctx: SetupContext<{(e: 'foo' | 'bar'): void; (e: 'baz', id: number): void;}>) => {}) |
24 changes: 24 additions & 0 deletions
24
visitor/tests/fixture/resolve-emits-types/fn-type/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
defineComponent((_, ctx: SetupContext<(e: 'foo' | 'bar') => void>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); | ||
defineComponent((_, ctx: SetupContext<((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void)>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar", | ||
"baz" | ||
] | ||
}); | ||
defineComponent((_, ctx: SetupContext<{ | ||
(e: 'foo' | 'bar') : void; | ||
(e: 'baz', id: number) : void; | ||
}>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar", | ||
"baz" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/interface-with-extends/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
6 changes: 6 additions & 0 deletions
6
visitor/tests/fixture/resolve-emits-types/interface-with-extends/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
interface Base { (e: 'foo'): void } | ||
interface Emits extends Base { (e: 'bar'): void } | ||
|
||
defineComponent((_, ctx: SetupContext<Emits>) => {}) |
13 changes: 13 additions & 0 deletions
13
visitor/tests/fixture/resolve-emits-types/interface-with-extends/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
interface Base { | ||
(e: 'foo') : void; | ||
} | ||
interface Emits extends Base { | ||
(e: 'bar') : void; | ||
} | ||
defineComponent((_, ctx: SetupContext<Emits>)=>{}, { | ||
emits: [ | ||
"bar", | ||
"foo" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/interface/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
5 changes: 5 additions & 0 deletions
5
visitor/tests/fixture/resolve-emits-types/interface/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
interface Emits { (e: 'foo' | 'bar'): void } | ||
|
||
defineComponent((_, ctx: SetupContext<Emits>) => {}) |
10 changes: 10 additions & 0 deletions
10
visitor/tests/fixture/resolve-emits-types/interface/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
interface Emits { | ||
(e: 'foo' | 'bar') : void; | ||
} | ||
defineComponent((_, ctx: SetupContext<Emits>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/property-syntax/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
5 changes: 5 additions & 0 deletions
5
visitor/tests/fixture/resolve-emits-types/property-syntax/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
defineComponent((_, ctx: SetupContext<{ foo: [], bar: [] }>) => {}) | ||
|
||
defineComponent((_, ctx: SetupContext<{ 'foo:bar': [] }>) => {}) |
17 changes: 17 additions & 0 deletions
17
visitor/tests/fixture/resolve-emits-types/property-syntax/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
defineComponent((_, ctx: SetupContext<{ | ||
foo: []; | ||
bar: []; | ||
}>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); | ||
defineComponent((_, ctx: SetupContext<{ | ||
'foo:bar': []; | ||
}>)=>{}, { | ||
emits: [ | ||
"foo:bar" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/referenced-exported-fn-type/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
5 changes: 5 additions & 0 deletions
5
visitor/tests/fixture/resolve-emits-types/referenced-exported-fn-type/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
export type Emits = (e: 'foo' | 'bar') => void | ||
|
||
defineComponent((_, ctx: SetupContext<Emits>) => {}) |
8 changes: 8 additions & 0 deletions
8
visitor/tests/fixture/resolve-emits-types/referenced-exported-fn-type/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
export type Emits = (e: 'foo' | 'bar') => void; | ||
defineComponent((_, ctx: SetupContext<Emits>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/referenced-fn-type/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
5 changes: 5 additions & 0 deletions
5
visitor/tests/fixture/resolve-emits-types/referenced-fn-type/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
type Emits = (e: 'foo' | 'bar') => void | ||
|
||
defineComponent((_, ctx: SetupContext<Emits>) => {}) |
8 changes: 8 additions & 0 deletions
8
visitor/tests/fixture/resolve-emits-types/referenced-fn-type/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
type Emits = (e: 'foo' | 'bar') => void; | ||
defineComponent((_, ctx: SetupContext<Emits>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/type-alias/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
5 changes: 5 additions & 0 deletions
5
visitor/tests/fixture/resolve-emits-types/type-alias/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
type Emits = { (e: 'foo' | 'bar'): void } | ||
|
||
defineComponent((_, ctx: SetupContext<Emits>) => {}) |
10 changes: 10 additions & 0 deletions
10
visitor/tests/fixture/resolve-emits-types/type-alias/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
type Emits = { | ||
(e: 'foo' | 'bar') : void; | ||
}; | ||
defineComponent((_, ctx: SetupContext<Emits>)=>{}, { | ||
emits: [ | ||
"foo", | ||
"bar" | ||
] | ||
}); |
3 changes: 3 additions & 0 deletions
3
visitor/tests/fixture/resolve-emits-types/type-references-in-union/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"resolveType": true | ||
} |
9 changes: 9 additions & 0 deletions
9
visitor/tests/fixture/resolve-emits-types/type-references-in-union/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineComponent, type SetupContext } from 'vue' | ||
|
||
type BaseEmit = "change" | ||
type Emit = "some" | "emit" | BaseEmit | ||
|
||
defineComponent((_, ctx: SetupContext<{ | ||
(e: Emit): void; | ||
(e: "another", val: string): void; | ||
}>) => {}) |
14 changes: 14 additions & 0 deletions
14
visitor/tests/fixture/resolve-emits-types/type-references-in-union/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineComponent, type SetupContext } from 'vue'; | ||
type BaseEmit = "change"; | ||
type Emit = "some" | "emit" | BaseEmit; | ||
defineComponent((_, ctx: SetupContext<{ | ||
(e: Emit) : void; | ||
(e: "another", val: string) : void; | ||
}>)=>{}, { | ||
emits: [ | ||
"some", | ||
"emit", | ||
"change", | ||
"another" | ||
] | ||
}); |