Flow: interface identifier should be declared in the scope (#10220)

* fix: typo

* declare name for flow interface

* add test case for export overload function, typescript

* test: add test

Fixes #10044

* test: update test

* test(flow): add multiple declarations regression test

* re-enable flow test case

# Conflicts:
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js
#	packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js

* test: disable two flow dupl-decl test

* fix: do not declare name for declare function until we figure out a better way

* test: duplicate declare function and function would not throw
This commit is contained in:
Huáng Jùnliàng
2019-10-02 01:32:42 -04:00
committed by Nicolò Ribaudo
parent 02f2d17e83
commit fa5057f9fb
78 changed files with 2013 additions and 76 deletions

View File

@@ -4,13 +4,13 @@ declare function foo(): void
declare function foo(): void;
declare function foo<T>(): void;
declare function foo(x: number, y: string): void;
declare class A {}
declare class A<T> extends B<T> { x: number }
declare class A { static foo(): number, static x : string }
declare class A { static [ indexer: number]: string }
declare class A { static () : number }
declare class A mixins B<T>, C {}
declare type A = string
declare class A1 {}
declare class A1<T> extends B<T> { x: number }
declare class A1 { static foo(): number, static x : string }
declare class A1 { static [ indexer: number]: string }
declare class A1 { static () : number }
declare class A1 mixins B<T>, C {}
declare type A2 = string
declare type T<U> = { [k:string]: U }
declare interface I { foo: string }
declare interface I<T> { foo: T }
declare interface I1 { foo: string }
declare interface I2<T> { foo: T }

View File

@@ -10,22 +10,22 @@
/*:: declare function foo(x: number, y: string): void;*/
/*:: declare class A {}*/
/*:: declare class A1 {}*/
/*:: declare class A<T> extends B<T> { x: number }*/
/*:: declare class A1<T> extends B<T> { x: number }*/
/*:: declare class A { static foo(): number, static x : string }*/
/*:: declare class A1 { static foo(): number, static x : string }*/
/*:: declare class A { static [ indexer: number]: string }*/
/*:: declare class A1 { static [ indexer: number]: string }*/
/*:: declare class A { static () : number }*/
/*:: declare class A1 { static () : number }*/
/*:: declare class A mixins B<T>, C {}*/
/*:: declare class A1 mixins B<T>, C {}*/
/*:: declare type A = string*/
/*:: declare type A2 = string*/
/*:: declare type T<U> = { [k:string]: U }*/
/*:: declare interface I { foo: string }*/
/*:: declare interface I1 { foo: string }*/
/*:: declare interface I<T> { foo: T }*/
/*:: declare interface I2<T> { foo: T }*/