Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dts-dom

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dts-dom - npm Package Compare versions

Comparing version 0.1.18 to 0.1.20

31

bin/index.d.ts

@@ -32,3 +32,3 @@ export interface DeclarationBase {

}
export interface IndexSignature {
export interface IndexSignature extends DeclarationBase {
kind: "index-signature";

@@ -39,2 +39,8 @@ name: string;

}
export interface CallSignature extends DeclarationBase {
kind: "call-signature";
parameters: Parameter[];
returnType: Type;
typeParameters: TypeParameter[];
}
export interface MethodDeclaration extends DeclarationBase {

@@ -128,2 +134,3 @@ kind: "method";

type: Type;
typeParameters: TypeParameter[];
}

@@ -142,8 +149,16 @@ export interface ArrayTypeReference {

}
export declare type PrimitiveType = "string" | "number" | "boolean" | "any" | "void";
export interface StringLiteral {
kind: "string-literal";
value: string;
}
export interface NumberLiteral {
kind: "number-literal";
value: number;
}
export declare type PrimitiveType = "string" | "number" | "boolean" | "any" | "void" | "object" | "null" | "undefined" | "true" | "false" | StringLiteral | NumberLiteral;
export declare type ThisType = "this";
export declare type TypeReference = TopLevelDeclaration | NamedTypeReference | ArrayTypeReference | PrimitiveType;
export declare type ObjectTypeReference = ClassDeclaration | InterfaceDeclaration;
export declare type ObjectTypeMember = PropertyDeclaration | MethodDeclaration | IndexSignature;
export declare type ClassMember = ObjectTypeMember | ConstructorDeclaration;
export declare type ObjectTypeMember = PropertyDeclaration | MethodDeclaration | IndexSignature | CallSignature;
export declare type ClassMember = PropertyDeclaration | MethodDeclaration | IndexSignature | ConstructorDeclaration;
export declare type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType | TypeofReference | FunctionType | TypeParameter | ThisType;

@@ -182,2 +197,3 @@ export declare type Import = ImportAllDeclaration | ImportDefaultDeclaration | ImportNamedDeclaration;

method(name: string, parameters: Parameter[], returnType: Type, flags?: DeclarationFlags): MethodDeclaration;
callSignature(parameters: Parameter[], returnType: Type): CallSignature;
function(name: string, parameters: Parameter[], returnType: Type): FunctionDeclaration;

@@ -204,2 +220,4 @@ functionType(parameters: Parameter[], returnType: Type): FunctionType;

array(type: Type): ArrayTypeReference;
stringLiteral(string: string): PrimitiveType;
numberLiteral(number: number): PrimitiveType;
string: PrimitiveType;

@@ -210,2 +228,7 @@ number: PrimitiveType;

void: PrimitiveType;
object: PrimitiveType;
null: PrimitiveType;
undefined: PrimitiveType;
true: PrimitiveType;
false: PrimitiveType;
this: "this";

@@ -212,0 +235,0 @@ };

@@ -78,2 +78,9 @@ "use strict";

},
callSignature: function (parameters, returnType) {
return {
kind: "call-signature",
typeParameters: [],
parameters: parameters, returnType: returnType
};
},
function: function (name, parameters, returnType) {

@@ -114,3 +121,4 @@ return {

return {
kind: "alias", name: name, type: type
kind: "alias", name: name, type: type,
typeParameters: []
};

@@ -203,2 +211,14 @@ },

},
stringLiteral: function (string) {
return {
kind: "string-literal",
value: string
};
},
numberLiteral: function (number) {
return {
kind: "number-literal",
value: number
};
},
string: "string",

@@ -209,2 +229,7 @@ number: "number",

void: "void",
object: "object",
null: "null",
undefined: "undefined",
true: "true",
false: "false",
this: "this"

@@ -385,2 +410,23 @@ };

return;
case "call-signature": {
printDeclarationComments(member);
tab();
writeTypeParameters(member.typeParameters);
print("(");
var first_1 = true;
for (var _i = 0, _a = member.parameters; _i < _a.length; _i++) {
var param = _a[_i];
if (!first_1)
print(", ");
first_1 = false;
print(param.name);
print(": ");
writeReference(param.type);
}
print("): ");
writeReference(member.returnType);
print(";");
newline();
return;
}
case 'method':

@@ -394,10 +440,8 @@ printDeclarationComments(member);

var first = true;
for (var _i = 0, _a = member.parameters; _i < _a.length; _i++) {
var param = _a[_i];
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (!first)
print(', ');
first = false;
print(param.name);
print(': ');
writeReference(param.type);
writeParameter(param);
}

@@ -451,2 +495,13 @@ print('): ');

break;
case "string-literal":
print(JSON.stringify(e.value));
break;
case "number-literal":
if (isNaN(e.value))
print("typeof NaN");
else if (!isFinite(e.value))
print("typeof Infinity");
else
print(e.value.toString());
break;
case "function-type":

@@ -638,3 +693,5 @@ writeFunctionType(e);

printDeclarationComments(a);
startWithDeclareOrExport("type " + a.name + " = ", a.flags);
startWithDeclareOrExport("type " + a.name, a.flags);
writeTypeParameters(a.typeParameters);
print(' = ');
writeReference(a.type);

@@ -641,0 +698,0 @@ print(';');

@@ -38,3 +38,3 @@ export interface DeclarationBase {

export interface IndexSignature {
export interface IndexSignature extends DeclarationBase {
kind: "index-signature";

@@ -46,2 +46,9 @@ name: string;

export interface CallSignature extends DeclarationBase {
kind: "call-signature";
parameters: Parameter[];
returnType: Type;
typeParameters: TypeParameter[];
}
export interface MethodDeclaration extends DeclarationBase {

@@ -151,2 +158,3 @@ kind: "method";

type: Type;
typeParameters: TypeParameter[];
}

@@ -169,4 +177,14 @@

export type PrimitiveType = "string" | "number" | "boolean" | "any" | "void";
export interface StringLiteral {
kind: "string-literal";
value: string;
}
export interface NumberLiteral {
kind: "number-literal";
value: number;
}
export type PrimitiveType = "string" | "number" | "boolean" | "any" | "void" | "object" | "null" | "undefined" | "true" | "false" | StringLiteral | NumberLiteral;
export type ThisType = "this";

@@ -177,4 +195,4 @@

export type ObjectTypeReference = ClassDeclaration | InterfaceDeclaration;
export type ObjectTypeMember = PropertyDeclaration | MethodDeclaration | IndexSignature;
export type ClassMember = ObjectTypeMember | ConstructorDeclaration;
export type ObjectTypeMember = PropertyDeclaration | MethodDeclaration | IndexSignature | CallSignature;
export type ClassMember = PropertyDeclaration | MethodDeclaration | IndexSignature | ConstructorDeclaration;

@@ -269,2 +287,10 @@ export type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType | TypeofReference | FunctionType | TypeParameter | ThisType;

callSignature(parameters: Parameter[], returnType: Type): CallSignature {
return {
kind: "call-signature",
typeParameters: [],
parameters, returnType
};
},
function(name: string, parameters: Parameter[], returnType: Type): FunctionDeclaration {

@@ -308,3 +334,4 @@ return {

return {
kind: "alias", name, type
kind: "alias", name, type,
typeParameters: []
};

@@ -410,2 +437,14 @@ },

},
stringLiteral(string: string): PrimitiveType {
return {
kind: "string-literal",
value: string
}
},
numberLiteral(number: number): PrimitiveType {
return {
kind: "number-literal",
value: number
}
},
string: <PrimitiveType>"string",

@@ -416,2 +455,7 @@ number: <PrimitiveType>"number",

void: <PrimitiveType>"void",
object: <PrimitiveType>"object",
null: <PrimitiveType>"null",
undefined: <PrimitiveType>"undefined",
true: <PrimitiveType>"true",
false: <PrimitiveType>"false",
this: <ThisType>"this"

@@ -608,2 +652,21 @@ };

return;
case "call-signature": {
printDeclarationComments(member);
tab();
writeTypeParameters(member.typeParameters);
print("(");
let first = true;
for (const param of member.parameters) {
if (!first) print(", ");
first = false;
print(param.name);
print(": ");
writeReference(param.type);
}
print("): ");
writeReference(member.returnType);
print(";");
newline();
return;
}
case 'method':

@@ -619,5 +682,3 @@ printDeclarationComments(member);

first = false;
print(param.name);
print(': ');
writeReference(param.type);
writeParameter(param);
}

@@ -669,2 +730,12 @@ print('): ');

break;
case "string-literal":
print(JSON.stringify(e.value));
break;
case "number-literal":
if (isNaN(e.value)) print("typeof NaN");
else if (!isFinite(e.value)) print("typeof Infinity");
else print(e.value.toString());
break;

@@ -875,3 +946,5 @@ case "function-type":

printDeclarationComments(a);
startWithDeclareOrExport(`type ${a.name} = `, a.flags);
startWithDeclareOrExport(`type ${a.name}`, a.flags);
writeTypeParameters(a.typeParameters);
print(' = ');
writeReference(a.type);

@@ -878,0 +951,0 @@ print(';');

2

package.json
{
"name": "dts-dom",
"version": "0.1.18",
"version": "0.1.20",
"homepage": "https://github.com/RyanCavanaugh/dts-dom",

@@ -5,0 +5,0 @@ "description": "DOM for TypeScript Declaration Files",

@@ -25,3 +25,3 @@ [![npm version](https://badge.fury.io/js/dts-dom.svg)](https://badge.fury.io/js/dts-dom)

dom.type.void,
dom.MemberFlags.Optional));
dom.DeclarationFlags.Optional));

@@ -28,0 +28,0 @@ const ns = dom.create.namespace('SomeNamespace');

@@ -9,3 +9,3 @@ import * as dom from '../../dts-dom';

dom.type.void,
dom.MemberFlags.Optional));
dom.DeclarationFlags.Optional));

@@ -12,0 +12,0 @@ const ns = dom.create.namespace('SomeNamespace');

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc