Daniel Tschinder a7391144b3
Introduce scope tracking in the parser (#9493)
* Introduce scope tracking

* Fix tests

* Add new tests

* Remove constructor-super check from transform as it is now in parser

* Correctly handle class properties and class scope

* Fix duplicate name check

* Convert scope identifier storage to array

* Enter a new scope in typescript module blocks

* Add test for duplicate declaration

* Rename error for duplicate exports

* Treat class declarations as lexical declaration

* Update whitelist

* Add tests

* Fix scope tracking for function declarations

* Migrate try-catch duplicate error

* Fix test

* More tests

* One more test

* Make scope a separate class and fix review comments

* Do not allow new.target in top scope arrow function

* Correctly enter new scope for declare module and treat type aliases as lexical declarations

* Tests for typescript scope tracking to not mark type aliases as duplicate

* Fix flow scope tracking

* Remove ident from test names as redundant

* Add test case for var and function

* Improve error messages

* Improve literal regex
2019-02-25 11:04:52 -08:00

33 lines
1.1 KiB
JavaScript

declare export var foo
declare export var foo;
declare export function foo(): void
declare export function foo(): void;
declare export function foo<T>(): void;
declare export function foo(x: number, y: string): void;
declare export class A {}
declare export class A<T> extends B<T> { x: number }
declare export class A { static foo(): number; static x : string }
declare export class A { static [ indexer: number]: string }
declare export class A { static () : number }
declare export class A mixins B<T>, C {}
declare export default class A {}
declare export default function foo(): void;
declare export default string
declare export * from 'asd';
declare export { a, b };
declare export {};
declare export { c, d } from 'bar';
declare module B {
declare export type B = {};
declare export interface Moon {}
}
declare module "foo" { declare export type * from "bar"; }
declare export opaque type Foo1;
declare export opaque type Bar<T>;
declare export opaque type Baz: Foo;
declare export opaque type Foo3<T>: Bar<T>;
declare export opaque type Foo4<T>: Bar;
declare export opaque type Foo5: Bar<T>;