Comparing version 0.1.14 to 0.1.15
@@ -32,2 +32,8 @@ export interface DeclarationBase { | ||
} | ||
export interface IndexSignature { | ||
kind: "index-signature"; | ||
name: string; | ||
indexType: ("string" | "number"); | ||
valueType: Type; | ||
} | ||
export interface MethodDeclaration extends DeclarationBase { | ||
@@ -131,3 +137,3 @@ kind: "method"; | ||
export declare type ObjectTypeReference = ClassDeclaration | InterfaceDeclaration; | ||
export declare type ObjectTypeMember = PropertyDeclaration | MethodDeclaration; | ||
export declare type ObjectTypeMember = PropertyDeclaration | MethodDeclaration | IndexSignature; | ||
export declare type ClassMember = ObjectTypeMember | ConstructorDeclaration; | ||
@@ -175,2 +181,3 @@ export declare type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType | TypeofReference | FunctionType | TypeParameter; | ||
objectType(members: ObjectTypeMember[]): ObjectType; | ||
indexSignature(name: string, indexType: "string" | "number", valueType: Type): IndexSignature; | ||
array(type: Type): ArrayTypeReference; | ||
@@ -177,0 +184,0 @@ namedTypeReference(name: string): NamedTypeReference; |
@@ -127,2 +127,8 @@ "use strict"; | ||
}, | ||
indexSignature: function (name, indexType, valueType) { | ||
return { | ||
kind: 'index-signature', | ||
name: name, indexType: indexType, valueType: valueType | ||
}; | ||
}, | ||
array: function (type) { | ||
@@ -300,2 +306,3 @@ return { | ||
case "class": | ||
case "union": | ||
return true; | ||
@@ -341,2 +348,12 @@ default: | ||
switch (member.kind) { | ||
case 'index-signature': | ||
printDeclarationComments(member); | ||
tab(); | ||
print("[" + member.name + ": "); | ||
writeReference(member.indexType); | ||
print(']: '); | ||
writeReference(member.valueType); | ||
print(';'); | ||
newline(); | ||
return; | ||
case 'method': | ||
@@ -343,0 +360,0 @@ printDeclarationComments(member); |
@@ -38,2 +38,9 @@ export interface DeclarationBase { | ||
export interface IndexSignature { | ||
kind: "index-signature"; | ||
name: string; | ||
indexType: ("string"|"number"); | ||
valueType: Type; | ||
} | ||
export interface MethodDeclaration extends DeclarationBase { | ||
@@ -158,3 +165,3 @@ kind: "method"; | ||
export type ObjectTypeReference = ClassDeclaration | InterfaceDeclaration; | ||
export type ObjectTypeMember = PropertyDeclaration | MethodDeclaration; | ||
export type ObjectTypeMember = PropertyDeclaration | MethodDeclaration | IndexSignature; | ||
export type ClassMember = ObjectTypeMember | ConstructorDeclaration; | ||
@@ -306,2 +313,9 @@ | ||
indexSignature(name: string, indexType: ('string'|'number'), valueType: Type): IndexSignature { | ||
return { | ||
kind: 'index-signature', | ||
name, indexType, valueType | ||
} | ||
}, | ||
array(type: Type): ArrayTypeReference { | ||
@@ -508,2 +522,3 @@ return { | ||
case "class": | ||
case "union": | ||
return true; | ||
@@ -551,2 +566,12 @@ default: | ||
switch (member.kind) { | ||
case 'index-signature': | ||
printDeclarationComments(member); | ||
tab(); | ||
print(`[${member.name}: `); | ||
writeReference(member.indexType); | ||
print(']: '); | ||
writeReference(member.valueType); | ||
print(';'); | ||
newline(); | ||
return; | ||
case 'method': | ||
@@ -553,0 +578,0 @@ printDeclarationComments(member); |
{ | ||
"name": "dts-dom", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"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
88141
1757