Fixed braceless type tags with types starting with an open parenthesis (#57167)

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
Mateusz Burzyński
2024-04-06 00:38:53 +02:00
committed by GitHub
parent bdd1f947f6
commit 9ba0800646
7 changed files with 167 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
// @strict: true
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @filename: index.js
/** @type () => string */
function fn1() {
return 42;
}
/** @type () => string */
function fn2() {
return "foo";
}
/** @type (arg: string) => string */
function fn3(arg) {
return arg;
}
/** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */
const obj1 = { type: "foo", prop: 10 };
/** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */
const obj2 = { type: "other", prop: 10 };