forked from import-js/eslint-plugin-import
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request import-js#1356 from christophercurrie/typescript-d…
…eclare Improve support for Typescript declare structures
- Loading branch information
Showing
5 changed files
with
198 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export declare type MyType = string | ||
export declare enum MyEnum { | ||
Foo, | ||
Bar, | ||
Baz | ||
} | ||
export declare interface Foo { | ||
native: string | number | ||
typedef: MyType | ||
enum: MyEnum | ||
} | ||
|
||
export declare abstract class Bar { | ||
abstract foo(): Foo | ||
|
||
method(); | ||
} | ||
|
||
export declare function getFoo() : MyType; | ||
|
||
export declare module MyModule { | ||
export function ModuleFunction(); | ||
} | ||
|
||
export declare namespace MyNamespace { | ||
export function NamespaceFunction(); | ||
|
||
export module NSModule { | ||
export function NSModuleFunction(); | ||
} | ||
} | ||
|
||
interface NotExported {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export = AssignedNamespace; | ||
|
||
declare namespace AssignedNamespace { | ||
type MyType = string | ||
enum MyEnum { | ||
Foo, | ||
Bar, | ||
Baz | ||
} | ||
|
||
interface Foo { | ||
native: string | number | ||
typedef: MyType | ||
enum: MyEnum | ||
} | ||
|
||
abstract class Bar { | ||
abstract foo(): Foo | ||
|
||
method(); | ||
} | ||
|
||
export function getFoo() : MyType; | ||
|
||
export module MyModule { | ||
export function ModuleFunction(); | ||
} | ||
|
||
export namespace MyNamespace { | ||
export function NamespaceFunction(); | ||
|
||
export module NSModule { | ||
export function NSModuleFunction(); | ||
} | ||
} | ||
|
||
// Export-assignment exports all members in the namespace, explicitly exported or not. | ||
// interface NotExported {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters