Comparing version 0.1.17 to 0.1.18
@@ -75,2 +75,8 @@ export interface DeclarationBase { | ||
} | ||
export interface ImportNamedDeclaration extends DeclarationBase { | ||
kind: "importNamed"; | ||
name: string; | ||
as?: string; | ||
from: string; | ||
} | ||
export interface ImportDefaultDeclaration extends DeclarationBase { | ||
@@ -141,3 +147,3 @@ kind: "importDefault"; | ||
export declare type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType | TypeofReference | FunctionType | TypeParameter | ThisType; | ||
export declare type Import = ImportAllDeclaration | ImportDefaultDeclaration; | ||
export declare type Import = ImportAllDeclaration | ImportDefaultDeclaration | ImportNamedDeclaration; | ||
export declare type NamespaceMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration; | ||
@@ -189,2 +195,3 @@ export declare type ModuleMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | Import; | ||
importDefault(name: string, from: string): ImportDefaultDeclaration; | ||
importNamed(name: string, as: string, from?: string | undefined): ImportNamedDeclaration; | ||
union(members: Type[]): UnionType; | ||
@@ -191,0 +198,0 @@ typeof(type: NamedTypeReference): TypeofReference; |
@@ -173,2 +173,10 @@ "use strict"; | ||
}, | ||
importNamed: function (name, as, from) { | ||
return { | ||
kind: 'importNamed', | ||
name: name, | ||
as: typeof from !== 'undefined' ? as : undefined, | ||
from: typeof from !== 'undefined' ? from : as | ||
}; | ||
}, | ||
union: function (members) { | ||
@@ -657,2 +665,10 @@ return { | ||
} | ||
function writeImportNamed(i) { | ||
start("import {" + i.name); | ||
if (i.as) { | ||
print(" as " + i.as); | ||
} | ||
print("} from '" + i.from + "';"); | ||
newline(); | ||
} | ||
function writeEnum(e) { | ||
@@ -703,2 +719,4 @@ printDeclarationComments(e); | ||
return writeImportDefault(d); | ||
case "importNamed": | ||
return writeImportNamed(d); | ||
case "enum": | ||
@@ -705,0 +723,0 @@ return writeEnum(d); |
@@ -88,2 +88,9 @@ export interface DeclarationBase { | ||
export interface ImportNamedDeclaration extends DeclarationBase { | ||
kind: "importNamed"; | ||
name: string; | ||
as?: string; | ||
from: string; | ||
} | ||
export interface ImportDefaultDeclaration extends DeclarationBase { | ||
@@ -172,3 +179,3 @@ kind: "importDefault"; | ||
export type Import = ImportAllDeclaration | ImportDefaultDeclaration; | ||
export type Import = ImportAllDeclaration | ImportDefaultDeclaration | ImportNamedDeclaration; | ||
@@ -367,2 +374,11 @@ export type NamespaceMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration; | ||
importNamed(name: string, as: string, from?: string): ImportNamedDeclaration { | ||
return { | ||
kind: 'importNamed', | ||
name, | ||
as: typeof from !== 'undefined' ? as : undefined, | ||
from: typeof from !== 'undefined' ? from : as | ||
}; | ||
}, | ||
union(members: Type[]): UnionType { | ||
@@ -887,2 +903,11 @@ return { | ||
function writeImportNamed(i: ImportNamedDeclaration) { | ||
start(`import {${i.name}`); | ||
if (i.as) { | ||
print(` as ${i.as}`); | ||
} | ||
print(`} from '${i.from}';`); | ||
newline(); | ||
} | ||
function writeEnum(e: EnumDeclaration) { | ||
@@ -933,2 +958,4 @@ printDeclarationComments(e); | ||
return writeImportDefault(d); | ||
case "importNamed": | ||
return writeImportNamed(d); | ||
case "enum": | ||
@@ -935,0 +962,0 @@ return writeEnum(d); |
{ | ||
"name": "dts-dom", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"homepage": "https://github.com/RyanCavanaugh/dts-dom", | ||
@@ -5,0 +5,0 @@ "description": "DOM for TypeScript Declaration Files", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92357
1836