diff options
author | 2023-08-23 17:22:54 -0700 | |
---|---|---|
committer | 2023-08-23 17:22:54 -0700 | |
commit | 20d42dfaa3c23c1302dd3d5837ba6714dc891ac4 (patch) | |
tree | 6209daa8075a5e1076d1589a32235e1b0ebab156 /test | |
parent | 3556fa3b1e80c9e3587c053a7761d07e65e2dcd8 (diff) | |
download | bun-20d42dfaa3c23c1302dd3d5837ba6714dc891ac4.tar.gz bun-20d42dfaa3c23c1302dd3d5837ba6714dc891ac4.tar.zst bun-20d42dfaa3c23c1302dd3d5837ba6714dc891ac4.zip |
Fix `<const T>() =>` (#4278)bun-v0.8.0
Diffstat (limited to 'test')
-rw-r--r-- | test/bundler/bundler_edgecase.test.ts | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/bundler/bundler_edgecase.test.ts b/test/bundler/bundler_edgecase.test.ts index 0cbb97b1e..59c013782 100644 --- a/test/bundler/bundler_edgecase.test.ts +++ b/test/bundler/bundler_edgecase.test.ts @@ -929,6 +929,76 @@ describe("bundler", () => { stdout: "pass", }, }); + itBundled("edgecase/TS_LessThanAmbiguity", { + files: { + "/entry.ts": ` + function expectArrow(item) { + if(typeof item !== 'function') { + throw new Error('Expected arrow function'); + } + } + function expectTypeCast(item) { + if(typeof item !== 'number') { + throw new Error('Expected arrow function'); + } + } + const x = 1; + expectTypeCast(<A>(x)); + expectTypeCast(<[]>(x)); + expectTypeCast(<A[]>(x)); + + expectArrow(<A>(x) => {}) + expectArrow(<A, B>(x) => {}) + expectArrow(<A = B>(x) => {}) + expectArrow(<A extends B>(x) => {}) + expectArrow(<const A extends B>(x) => {}) + + console.log('pass'); + `, + }, + run: { + stdout: "pass", + }, + }); + itBundled("edgecase/TSX_LessThanAmbiguity", { + files: { + "/entry.tsx": ` + function expectJSX(item) { + if(typeof item !== 'object') { + throw new Error('Expected JSX'); + } + } + function expectArrow(item) { + if(typeof item !== 'function') { + throw new Error('Expected arrow function'); + } + } + + const A = 1; + expectJSX(<A>(x) ...</A>); + expectJSX(<A extends>(x) ... </A>); + expectJSX(<A extends={false}>(x) ... </A>); + expectJSX(<const A extends>(x) ...</const>); + expectJSX(<const extends T>(x) ...</const>); + expectJSX(<const A B>(x) ...</const>); + expectJSX(<const A B C>(x) ...</const>); + + expectArrow(<A, B>(x) => {}); + expectArrow(<A extends B>(x) => {}); + expectArrow(<const A extends B>(x) => {}); + + console.log('pass'); + `, + "/node_modules/react/jsx-dev-runtime.js": ` + export function jsxDEV(type, props, key, isStaticChildren, source, self) { + return {}; + } + `, + }, + run: { + stdout: "pass", + }, + }); itBundled("edgecase/IsBuffer2", { files: { "/entry.js": /* js */ ` |