Socket
Socket
Sign inDemoInstall

@types/webidl2

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 23.13.6 to 24.4.0

205

webidl2/index.d.ts

@@ -1,5 +0,6 @@

// Type definitions for webidl2 23.13
// Type definitions for webidl2 24.4
// Project: https://github.com/w3c/webidl2.js#readme
// Definitions by: Kagama Sascha Rosylight <https://github.com/saschanaz>
// ExE Boss <https://github.com/ExE-Boss>
// Vinyl Da.i'gyu-Kazotetsu <https://github.com/queengooborg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -11,2 +12,4 @@

export function parse(str: string, options?: ParseOptions): IDLRootType[];
export function write(ast: IDLRootType[], options?: WriteOptions): string;
export function validate(ast: IDLRootType[]): WebIDLErrorData[];

@@ -46,15 +49,70 @@ export type IDLRootType =

export class WebIDLParseError extends Error {
constructor(options: {
message: string;
bareMessage: string;
context: string;
line: number;
sourceName?: string | undefined;
input: string;
tokens: Token[];
});
export interface WriteOptions {
templates?: {
/**
* A function that receives syntax strings plus anything the templates returned.
* The items are guaranteed to be ordered.
* The returned value may be again passed to any template functions,
* or it may also be the final return value of `write()`.
* @param items
*/
wrap?(items: any[]): any;
/**
* @param t A trivia string, which includes whitespaces and comments.
*/
trivia?(t: string): string;
/**
* The identifier for a container type. For example, the `Foo` part of `interface Foo {};`.
* @param escaped The escaped raw name of the definition.
* @param data The definition with the name
* @param parent The parent of the definition, undefined if absent
*/
name?(escaped: string, { data, parent }: { data: any; parent: any }): string;
/**
* Called for each type referece, e.g. `Window`, `DOMString`, or `unsigned long`.
* @param escaped The referenced name. Typically string, but may also be the return
* value of `wrap()` if the name contains whitespace.
* @param unescaped Unescaped reference.
*/
reference?(escaped: any, unescaped: any): any;
/**
* Called for each generic-form syntax, e.g. `sequence`, `Promise`, or `maplike`.
* @param name The keyword for syntax
*/
generic?(name: string): string;
/**
* Called for each nameless members, e.g. `stringifier` for `stringifier;` and `constructor` for `constructor();`
* @param keyword The keyword for syntax
*/
nameless?(keyword: string, { data, parent }: { data: any; parent: any }): string;
/**
* Called only once for each types, e.g. `Document`, `Promise<DOMString>`, or `sequence<long>`.
* @param type The `wrap()`ed result of references and syntatic bracket strings.
*/
type?(type: any): any;
/**
* Receives the return value of `reference()`. String if it's absent.
*/
inheritance?(inh: any): any;
/**
* Called for each IDL type definition, e.g. an interface, an operation, or a typedef.
* @param content The wrapped value of everything the definition contains.
* @param data The original definition object
* @param parent The parent of the definition, undefined if absent
*/
definition?(content: any, { data, parent }: { data: any; parent: any }): any;
/**
* Called for each extended attribute annotation.
* @param content The wrapped value of everything the annotation contains.
*/
extendedAttribute?(content: any): any;
/**
* The `Foo` part of `[Foo=Whatever]`.
* @param ref The name of the referenced extended attribute name.
*/
extendedAttributeReference?(ref: any): any;
};
}
name: "WebIDLParseError";
export class WebIDLError extends Error {
/** the error message */

@@ -64,4 +122,4 @@ message: string;

/** the line at which the error occurred. */
context: string;
/** the line at which the error occurred. */
line: number;

@@ -76,2 +134,27 @@ sourceName: string | undefined;

export class WebIDLParseError extends WebIDLError {
constructor(options: {
message: string;
bareMessage: string;
context: string;
line: number;
sourceName?: string | undefined;
input: string;
tokens: Token[];
});
name: 'WebIDLParseError';
}
export class WebIDLErrorData extends WebIDLError {
/** the level of error */
level: 'error' | 'warning';
/** A function to automatically fix the error */
autofix?(): void;
/** The name of the rule that threw the error */
ruleName: string;
}
export interface Token {

@@ -112,3 +195,3 @@ type: string;

/** String indicating the generic type (e.g. "Promise", "sequence"). The empty string otherwise. */
generic: IDLTypeDescription["generic"];
generic: IDLTypeDescription['generic'];
/** Boolean indicating whether this is a union type or not. */

@@ -134,3 +217,3 @@ union: false;

export interface FrozenArrayTypeDescription extends AbstractGenericTypeDescription {
generic: "FrozenArray";
generic: 'FrozenArray';
idlType: [IDLTypeDescription];

@@ -140,3 +223,3 @@ }

export interface ObservableArrayTypeDescription extends AbstractGenericTypeDescription {
generic: "ObservableArray";
generic: 'ObservableArray';
idlType: [IDLTypeDescription];

@@ -146,3 +229,3 @@ }

export interface PromiseTypeDescription extends AbstractGenericTypeDescription {
generic: "Promise";
generic: 'Promise';
idlType: [IDLTypeDescription];

@@ -152,3 +235,3 @@ }

export interface RecordTypeDescription extends AbstractGenericTypeDescription {
generic: "record";
generic: 'record';
idlType: [IDLTypeDescription, IDLTypeDescription];

@@ -158,3 +241,3 @@ }

export interface SequenceTypeDescription extends AbstractGenericTypeDescription {
generic: "sequence";
generic: 'sequence';
idlType: [IDLTypeDescription];

@@ -164,3 +247,3 @@ }

export interface SingleTypeDescription extends AbstractNonUnionTypeDescription {
generic: "";
generic: '';
/**

@@ -177,3 +260,3 @@ * In most cases, this will just be a string with the type name.

/** String indicating the generic type (e.g. "Promise", "sequence"). The empty string otherwise. */
generic: "";
generic: '';
/** Boolean indicating whether this is a union type or not. */

@@ -200,3 +283,3 @@ union: true;

export interface CallbackInterfaceType extends AbstractContainer {
type: "callback interface";
type: 'callback interface';
members: IDLCallbackInterfaceMemberType[];

@@ -208,3 +291,3 @@ inheritance: null;

export interface InterfaceType extends AbstractContainer {
type: "interface";
type: 'interface';
members: IDLInterfaceMemberType[];

@@ -217,3 +300,3 @@ /** A string giving the name of an interface this one inherits from, null otherwise. */

export interface InterfaceMixinType extends AbstractContainer {
type: "interface mixin";
type: 'interface mixin';
members: IDLInterfaceMixinMemberType[];

@@ -225,3 +308,3 @@ inheritance: null;

export interface NamespaceType extends AbstractContainer {
type: "namespace";
type: 'namespace';
members: IDLNamespaceMemberType[];

@@ -233,3 +316,3 @@ inheritance: null;

export interface CallbackType extends AbstractBase {
type: "callback";
type: 'callback';
/** The name of the callback. */

@@ -245,3 +328,3 @@ name: string;

export interface DictionaryType extends AbstractContainer {
type: "dictionary";
type: 'dictionary';
members: DictionaryMemberType[];

@@ -256,3 +339,3 @@ /** A string giving the name of a dictionary this one inherits from, null otherwise. */

export interface FieldType extends AbstractBase {
type: "field";
type: 'field';
/** The name of the field. */

@@ -270,7 +353,7 @@ name: string;

export interface EnumType extends AbstractBase {
type: "enum";
type: 'enum';
/** The enum's name. */
name: string;
/** An array of values (strings). */
values: Array<{ type: "enum-value"; value: string; parent: EnumType }>;
values: Array<{ type: 'enum-value'; value: string; parent: EnumType }>;
/** The container of this type. */

@@ -281,3 +364,3 @@ parent: null;

export interface TypedefType extends AbstractBase {
type: "typedef";
type: 'typedef';
/** The typedef's name. */

@@ -291,3 +374,3 @@ name: string;

export interface IncludesType extends AbstractBase {
type: "includes";
type: 'includes';
/** The interface that includes an interface mixin. */

@@ -301,3 +384,3 @@ target: string;

export interface ConstructorMemberType extends AbstractBase {
type: "constructor";
type: 'constructor';
/** An array of arguments for the constructor operation. */

@@ -309,5 +392,5 @@ arguments: Argument[];

export interface OperationMemberType extends AbstractBase {
type: "operation";
type: 'operation';
/** Special modifier if exists */
special: "getter" | "setter" | "deleter" | "static" | "stringifier" | null;
special: 'getter' | 'setter' | 'deleter' | 'static' | 'stringifier' | null;
/** An IDL Type of what the operation returns. If a stringifier, may be absent. */

@@ -323,7 +406,7 @@ idlType: IDLTypeDescription | null;

export interface AttributeMemberType extends AbstractBase {
type: "attribute";
type: 'attribute';
/** The attribute's name. */
name: string;
/** Special modifier if exists */
special: "static" | "stringifier" | null;
special: 'static' | 'stringifier' | null;
/** True if it's an inherit attribute. */

@@ -339,3 +422,3 @@ inherit: boolean;

export interface ConstantMemberType extends AbstractBase {
type: "const";
type: 'const';
/** Whether its type is nullable. */

@@ -353,3 +436,3 @@ nullable: boolean;

interface AbstractDeclarationMemberType extends AbstractBase {
type: DeclarationMemberType["type"];
type: DeclarationMemberType['type'];
/** An array with one or more IDL Types representing the declared type arguments. */

@@ -372,3 +455,3 @@ idlType: IDLTypeDescription[];

export interface IterableDeclarationMemberType extends AbstractDeclarationMemberType {
type: "iterable";
type: 'iterable';
idlType: [IDLTypeDescription] | [IDLTypeDescription, IDLTypeDescription];

@@ -386,3 +469,3 @@ async: boolean;

export interface MaplikeDeclarationMemberType extends AbstractCollectionLikeMemberType {
type: "maplike";
type: 'maplike';
idlType: [IDLTypeDescription, IDLTypeDescription];

@@ -392,3 +475,3 @@ }

export interface SetlikeDeclarationMemberType extends AbstractCollectionLikeMemberType {
type: "setlike";
type: 'setlike';
idlType: [IDLTypeDescription];

@@ -398,3 +481,3 @@ }

export interface Argument extends AbstractBase {
type: "argument";
type: 'argument';
/** A default value, absent if there is none. */

@@ -414,3 +497,3 @@ default: ValueDescription | null;

export interface ExtendedAttribute extends AbstractBase {
type: "extended-attribute";
type: 'extended-attribute';
/** The extended attribute's name. */

@@ -443,3 +526,3 @@ name: string;

export interface ExtendedAttributeRightHandSideIdentifier {
type: "identifier";
type: 'identifier';
value: string;

@@ -449,3 +532,3 @@ }

export interface ExtendedAttributeRightHandSideIdentifierList {
type: "identifier-list";
type: 'identifier-list';
value: ExtendedAttributeRightHandSideIdentifier[];

@@ -455,3 +538,3 @@ }

export interface ExtendedAttributeRightHandSideString {
type: "string";
type: 'string';
value: string;

@@ -461,3 +544,3 @@ }

export interface ExtendedAttributeRightHandSideStringList {
type: "string-list";
type: 'string-list';
value: ExtendedAttributeRightHandSideString[];

@@ -467,3 +550,3 @@ }

export interface ExtendedAttributeRightHandSideDecimal {
type: "decimal";
type: 'decimal';
value: string;

@@ -473,3 +556,3 @@ }

export interface ExtendedAttributeRightHandSideDecimalList {
type: "decimal-list";
type: 'decimal-list';
value: ExtendedAttributeRightHandSideDecimal[];

@@ -479,3 +562,3 @@ }

export interface ExtendedAttributeRightHandSideInteger {
type: "integer";
type: 'integer';
value: string;

@@ -485,3 +568,3 @@ }

export interface ExtendedAttributeRightHandSideIntegerList {
type: "integer-list";
type: 'integer-list';
value: ExtendedAttributeRightHandSideInteger[];

@@ -505,3 +588,3 @@ }

export interface ValueDescriptionString extends AbstractValueDescription {
type: "string";
type: 'string';
value: string;

@@ -511,3 +594,3 @@ }

export interface ValueDescriptionNumber extends AbstractValueDescription {
type: "number";
type: 'number';
value: string;

@@ -517,3 +600,3 @@ }

export interface ValueDescriptionBoolean extends AbstractValueDescription {
type: "boolean";
type: 'boolean';
value: boolean;

@@ -523,7 +606,7 @@ }

export interface ValueDescriptionNull extends AbstractValueDescription {
type: "null";
type: 'null';
}
export interface ValueDescriptionInfinity extends AbstractValueDescription {
type: "Infinity";
type: 'Infinity';
negative: boolean;

@@ -533,7 +616,7 @@ }

export interface ValueDescriptionNaN extends AbstractValueDescription {
type: "NaN";
type: 'NaN';
}
export interface ValueDescriptionSequence extends AbstractValueDescription {
type: "sequence";
type: 'sequence';
value: [];

@@ -543,3 +626,3 @@ }

export interface ValueDescriptionDictionary extends AbstractValueDescription {
type: "dictionary";
type: 'dictionary';
}
{
"name": "@types/webidl2",
"version": "23.13.6",
"version": "24.4.0",
"description": "TypeScript definitions for webidl2",

@@ -17,2 +17,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl2",

"githubUsername": "ExE-Boss"
},
{
"name": "Vinyl Da.i'gyu-Kazotetsu",
"url": "https://github.com/queengooborg",
"githubUsername": "queengooborg"
}

@@ -29,4 +34,4 @@ ],

"dependencies": {},
"typesPublisherContentHash": "fe84834833de7896ee668da8f30d95d4e74b63c05ea966b5e9c2361ccab3c220",
"typeScriptVersion": "3.6"
"typesPublisherContentHash": "2360b3214b98c97e48bf6352c1e1717aad97d54db5d714cf69eaa02b1b08040a",
"typeScriptVersion": "4.3"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Fri, 02 Jul 2021 18:05:21 GMT
* Last updated: Sat, 08 Jul 2023 13:32:43 GMT
* Dependencies: none

@@ -17,2 +17,2 @@ * Global values: `WebIDL2`

# Credits
These definitions were written by [Kagama Sascha Rosylight](https://github.com/saschanaz), and [ExE Boss](https://github.com/ExE-Boss).
These definitions were written by [Kagama Sascha Rosylight](https://github.com/saschanaz), [ExE Boss](https://github.com/ExE-Boss), and [Vinyl Da.i'gyu-Kazotetsu](https://github.com/queengooborg).
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc