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.10 to 0.1.11

15

bin/index.d.ts

@@ -87,2 +87,7 @@ export interface DeclarationBase {

}
export interface FunctionType {
kind: "function-type";
parameters: Parameter[];
returnType: Type;
}
export interface TypeAliasDeclaration extends DeclarationBase {

@@ -101,2 +106,6 @@ kind: "alias";

}
export interface TypeofReference {
kind: "typeof";
type: NamedTypeReference;
}
export declare type PrimitiveType = "string" | "number" | "boolean" | "any" | "void";

@@ -107,3 +116,3 @@ export declare type TypeReference = TopLevelDeclaration | NamedTypeReference | ArrayTypeReference | PrimitiveType;

export declare type ClassMember = ObjectTypeMember | ConstructorDeclaration;
export declare type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType;
export declare type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType | TypeofReference | FunctionType;
export declare type Import = ImportAllDeclaration | ImportDefaultDeclaration;

@@ -121,2 +130,3 @@ export declare type NamespaceMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration;

Abstract = 32,
ExportDefault = 64,
}

@@ -134,2 +144,3 @@ export declare enum ParameterFlags {

function(name: string, parameters: Parameter[], returnType: Type): FunctionDeclaration;
functionType(parameters: Parameter[], returnType: Type): FunctionType;
parameter(name: string, type: Type, flags?: ParameterFlags): Parameter;

@@ -146,2 +157,4 @@ constructor(parameters: Parameter[], flags?: DeclarationFlags): ConstructorDeclaration;

importDefault(name: string, from: string): ImportDefaultDeclaration;
union(members: Type[]): UnionType;
typeof(type: NamedTypeReference): TypeofReference;
};

@@ -148,0 +161,0 @@ export declare const type: {

@@ -10,2 +10,3 @@ "use strict";

DeclarationFlags[DeclarationFlags["Abstract"] = 32] = "Abstract";
DeclarationFlags[DeclarationFlags["ExportDefault"] = 64] = "ExportDefault";
})(exports.DeclarationFlags || (exports.DeclarationFlags = {}));

@@ -56,2 +57,8 @@ var DeclarationFlags = exports.DeclarationFlags;

},
functionType: function (parameters, returnType) {
return {
kind: "function-type",
parameters: parameters, returnType: returnType
};
},
parameter: function (name, type, flags) {

@@ -127,2 +134,14 @@ if (flags === void 0) { flags = ParameterFlags.None; }

};
},
union: function (members) {
return {
kind: 'union',
members: members
};
},
typeof: function (type) {
return {
kind: 'typeof',
type: type
};
}

@@ -227,2 +246,5 @@ };

}
else if (flags & DeclarationFlags.ExportDefault) {
start("export default " + s);
}
else {

@@ -340,2 +362,12 @@ start("declare " + s);

break;
case "function-type":
writeFunctionType(e);
break;
case "union":
writeDelimited(e.members, ' | ', writeReference);
break;
case "typeof":
print("typeof ");
writeReference(e.type);
break;
default:

@@ -363,2 +395,9 @@ throw new Error("Unknown kind " + d.kind);

}
function writeFunctionType(f) {
print('(');
writeDelimited(f.parameters, ', ', writeParameter);
print(')');
print('=>');
writeReference(f.returnType);
}
function writeFunction(f) {

@@ -365,0 +404,0 @@ printDeclarationComments(f);

@@ -104,2 +104,8 @@ export interface DeclarationBase {

export interface FunctionType {
kind: "function-type";
parameters: Parameter[];
returnType: Type;
}
export interface TypeAliasDeclaration extends DeclarationBase {

@@ -121,2 +127,7 @@ kind: "alias";

export interface TypeofReference {
kind: "typeof";
type: NamedTypeReference;
}
export type PrimitiveType = "string" | "number" | "boolean" | "any" | "void";

@@ -130,3 +141,3 @@

export type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType;
export type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType | TypeofReference | FunctionType;

@@ -146,3 +157,4 @@ export type Import = ImportAllDeclaration | ImportDefaultDeclaration;

Export = 1 << 4,
Abstract = 1 << 5
Abstract = 1 << 5,
ExportDefault = 1 << 6,
}

@@ -196,2 +208,9 @@

functionType(parameters: Parameter[], returnType: Type): FunctionType {
return {
kind: "function-type",
parameters, returnType
};
},
parameter(name: string, type: Type, flags = ParameterFlags.None): Parameter {

@@ -275,2 +294,16 @@ return {

};
},
union(members: Type[]): UnionType {
return {
kind: 'union',
members
};
},
typeof(type: NamedTypeReference): TypeofReference {
return {
kind: 'typeof',
type
};
}

@@ -395,2 +428,4 @@ };

start(`export ${s}`);
} else if (flags & DeclarationFlags.ExportDefault) {
start(`export default ${s}`);
} else {

@@ -509,2 +544,15 @@ start(`declare ${s}`);

case "function-type":
writeFunctionType(e);
break;
case "union":
writeDelimited(e.members, ' | ', writeReference);
break;
case "typeof":
print("typeof ");
writeReference(e.type);
break;
default:

@@ -533,2 +581,10 @@ throw new Error(`Unknown kind ${d.kind}`);

function writeFunctionType(f: FunctionType) {
print('(');
writeDelimited(f.parameters, ', ', writeParameter);
print(')');
print('=>');
writeReference(f.returnType);
}
function writeFunction(f: FunctionDeclaration) {

@@ -535,0 +591,0 @@ printDeclarationComments(f);

2

package.json
{
"name": "dts-dom",
"version": "0.1.10",
"version": "0.1.11",
"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

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