Skip to content

Commit 7798308

Browse files
committed
Refactor typed modules tests
1 parent b751a15 commit 7798308

File tree

2 files changed

+222
-234
lines changed

2 files changed

+222
-234
lines changed

src/typeChecker/__tests__/source4Typed.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,15 @@ describe('parse', () => {
6464
`"Line 1: Type 'Program | Statement' is not assignable to type 'number'."`
6565
)
6666
})
67+
68+
it('should error on variable redeclaration with different types', () => {
69+
const code = `
70+
const a: number = 10;
71+
const a: string = "oops";
72+
`
73+
parse(code, context)
74+
expect(parseError(context.errors)).toMatchInlineSnapshot(
75+
`"Line 3: SyntaxError: Identifier 'a' has already been declared (3:12)"`
76+
)
77+
})
6778
})

0 commit comments

Comments
 (0)