Skip to content

Commit

Permalink
add inferred return type test case
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleShit committed Apr 24, 2024
1 parent 4bee779 commit 26e7be7
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions packages/eslint-plugin/tests/rules/require-types-exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,18 @@ ruleTester.run('require-types-exports', rule, {
export function f<T extends Arg>(a: T): void {}
`,

`
export type R = number;
export function f() {
const value: { num: R } = {
num: 1,
};
return value;
}
`,
],

invalid: [
Expand Down Expand Up @@ -1600,6 +1612,31 @@ ruleTester.run('require-types-exports', rule, {
],
},

{
code: `
type R = number;
export function f() {
const value: { num: R } = {
num: 1,
};
return value;
}
`,
errors: [
{
messageId: 'requireTypeExport',
line: 5,
column: 31,
endColumn: 32,
data: {
name: 'R',
},
},
],
},

{
code: `
type Arg1 = number;
Expand Down

0 comments on commit 26e7be7

Please sign in to comment.