Skip to content

Commit a72d189

Browse files
test(typescript): Add test for optional chaining (#207)
* test(typescript): Add test for optional chaining * Skip failing test for now Co-authored-by: Tiger Oakes <contact@tigeroakes.com>
1 parent 4207609 commit a72d189

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
interface OC {
2+
a: number;
3+
b?: {
4+
c?: number;
5+
};
6+
}
7+
const o = { a: 1 } as OC;
8+
export default o.b?.c ?? 'NOT FOUND';

packages/typescript/test/test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,16 @@ test('supports CommonJS imports when the output format is CommonJS', async (t) =
525525
t.is(output, 'exported from commonjs');
526526
});
527527

528+
test.skip('supports optional chaining', async (t) => {
529+
const bundle = await rollup({
530+
input: 'fixtures/optional-chaining/main.ts',
531+
plugins: [typescript({ module: 'esnext', target: 'esnext' })],
532+
onwarn
533+
});
534+
const output = await evaluateBundle(bundle);
535+
t.is(output, 'NOT FOUND');
536+
});
537+
528538
function fakeTypescript(custom) {
529539
return Object.assign(
530540
{

0 commit comments

Comments
 (0)