8000 Quick fix for functions lacking return expressions by Kingwl · Pull Request #26434 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content

Quick fix for functions lacking return expressions #26434

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 28 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3f59aa9
stash
Kingwl Aug 10, 2018
7671221
add surmise for return type
Kingwl Aug 14, 2018
0b1e6cc
add support for more case
Kingwl Aug 14, 2018
1f9b9c0
add more test case
Kingwl Aug 16, 2018
aca1722
add more testcase and fix all test
Kingwl Aug 20, 2018
7cfd0fb
Merge branch 'master' into returnValueSurmise
Kingwl Apr 29, 2019
cbe59bb
fix changed diagnosis
Kingwl Apr 30, 2019
48f1cca
Merge branch 'master' into returnValueSurmise
Kingwl May 8, 2019
98d7eba
fix broken test case
Kingwl May 8, 2019
537e806
add more case
< 8000 span class="description"> Kingwl May 8, 2019
505e299
Merge branch 'master' into returnValueSurmise
Kingwl Jan 9, 2020
6fecf32
rename quickfix
Kingwl Jan 9, 2020
4c0af72
fix conflict
Kingwl Jan 9, 2020
98377f3
fix fix desc
Kingwl Jan 9, 2020
49d21bf
fix semi
Kingwl Jan 9, 2020
a2b15ed
Merge branch 'master' into returnValueSurmise
Kingwl Mar 4, 2020
eabc5a4
Merge branch 'master' into returnValueSurmise
Kingwl Mar 4, 2020
944ddf4
Avoid replace brace with paren
Kingwl Mar 18, 2020
6c88a01
Split fix all action
Kingwl Mar 18, 2020
94f845a
Add return work in same line
Kingwl Mar 18, 2020
a7f37a3
Merge branch 'master' into returnValueSurmise
Kingwl Mar 18, 2020
7fe9a82
fix test cases
Kingwl Mar 18, 2020
af9552e
rename baseline
Kingwl Mar 26, 2020
601fc5e
refactor and handle comment
Kingwl Mar 26, 2020
175cf4e
Support semi
Kingwl Mar 26, 2020
8b332fe
Merge branch 'master' into returnValueSurmise
Kingwl Mar 26, 2020
5d8355c
make helper internal
Kingwl Mar 26, 2020
522cac8
Merge branch 'master' into returnValueSurmise
Kingwl Apr 2, 2020
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
Prev Previous commit
Next Next commit
fix semi
  • Loading branch information
Kingwl committed Jan 9, 2020
commit 49d21bf0c6c6fd8bd77f6d08e71a32910a8b3bb6
1 change: 0 additions & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3546,7 +3546,6 @@ namespace ts {
* e.g. it specifies `kind: "a"` and obj has `kind: "b"`.
*/
/* @internal */ isTypeInvalidDueToUnionDiscriminant(contextualType: Type, obj: ObjectLiteralExpression | JsxAttributes): boolean;
/* @internal */ isTypeAssignableTo(type1: Type, type2: Type): boolean;
/**
* For a union, will include a property if it's defined in *any* of the member types.
* So for `{ a } | { b }`, this will include both `a` and `b`.
Expand Down
32 changes: 16 additions & 16 deletions tests/cases/fourslash/codeFixSurmiseReturnValue_all1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,55 +67,55 @@ verify.codeFixAll({

function foo1 (_a: () => number ) { }
foo1(() => {
return 1;
return 1
})
function foo2 (_a: () => A) { }
foo2(() => {
return { bar: '1' };
return { bar: '1' }
})
foo2(() => {
return { bar: '1' };
return { bar: '1' }
})
function foo3 (_a: () => A | number) { }
foo3(() => {
return 1;
return 1
})
foo3(() => {
return { bar: '1' };
return { bar: '1' }
})

function bar1 (): number {
return 1;
return 1
}
function bar2 (): A {
return { bar: '1' };
return { bar: '1' }
}
function bar3 (): A {
return { bar: '1' };
return { bar: '1' }
}
function bar4 (): A | number {
return 1;
return 1
}
function bar5(): A | number {
return { bar: '1' };
return { bar: '1' }
}
const baz1: () => number = () => {
return 1;
return 1
}
const baz2: () => A = () => {
return { bar: '1' };
return { bar: '1' }
}
const baz3: () => A = () => {
return { bar: '1' };
return { bar: '1' }
}
const baz4: ((() => number) | (() => A)) = () => {
return 1;
return 1
}
const baz5: ((() => number) | (() => A)) = () => {
return { bar: '1' };
return { bar: '1' }
}

const test: { a: () => A } = { a: () => {
return { bar: '1' };
return { bar: '1' }
} }`,
});
0