Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cli/tsc/dts/lib.deno.unstable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ declare namespace Deno {
success: boolean;
outputFiles?: OutputFile[];
}

export {}; // only export exports
}

/** **UNSTABLE**: New API, yet to be vetted.
Expand Down
82 changes: 62 additions & 20 deletions cli/tsc/dts/lib.deno_webgpu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,20 +759,32 @@ interface GPUCompilationInfo {
readonly messages: ReadonlyArray<GPUCompilationMessage>;
}

/** @category GPU */
declare class GPUPipelineError extends DOMException {
constructor(message?: string, options?: GPUPipelineErrorInit);

readonly reason: GPUPipelineErrorReason;
/**
* The **`GPUPipelineError`** interface of the WebGPU API describes a pipeline failure.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUPipelineError)
* @category GPU
*/
interface GPUPipelineError extends DOMException {
/**
* The **`reason`** read-only property of the GPUPipelineError interface defines the reason the pipeline creation failed in a machine-readable way.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUPipelineError/reason)
*/
readonly reason: "validation" | "internal";
}

/** @category GPU */
interface GPUPipelineErrorInit {
reason: GPUPipelineErrorReason;
}
declare var GPUPipelineError: {
prototype: GPUPipelineError;
new (message: string, options: GPUPipelineErrorInit): GPUPipelineError;
};

/** @category GPU */
type GPUPipelineErrorReason = "validation" | "internal";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporarily inlining this until TS 6.0. I don't think anyone uses this name.

Duplicate identifier 'GPUPipelineErrorReason'  @definitelytyped/expect
  7703:15  error  TypeScript@local compile error: 

interface GPUPipelineErrorInit {
reason: "validation" | "internal";
}

/**
* Represents a compiled shader module that can be used to create graphics or compute pipelines.
Expand Down Expand Up @@ -1584,25 +1596,55 @@ interface GPUDeviceLostInfo {
readonly message: string;
}

/** @category GPU */
declare class GPUError {
/**
* The **`GPUError`** interface of the WebGPU API is the base interface for errors surfaced by GPUDevice.popErrorScope and the GPUDevice.uncapturederror_event event.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUError)
* @category GPU
*/
interface GPUError {
/**
* The **`message`** read-only property of the A string.
* The **`message`** read-only property of the GPUError interface provides a human-readable message that explains why the error occurred.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUError/message)
*/
readonly message: string;
}

/** @category GPU */
declare class GPUOutOfMemoryError extends GPUError {
constructor(message: string);
}
declare var GPUError: {
prototype: GPUError;
new (): GPUError;
};

/** @category GPU */
declare class GPUValidationError extends GPUError {
constructor(message: string);
}
interface GPUOutOfMemoryError extends GPUError {}

/** @category GPU */
declare class GPUInternalError extends GPUError {
constructor(message: string);
}
declare var GPUOutOfMemoryError: {
prototype: GPUOutOfMemoryError;
new (message?: string): GPUOutOfMemoryError;
};

/** @category GPU */
interface GPUValidationError extends GPUError {}

/** @category GPU */
declare var GPUValidationError: {
prototype: GPUValidationError;
new (message?: string): GPUValidationError;
};

/** @category GPU */
interface GPUInternalError extends GPUError {}

/** @category GPU */
declare var GPUInternalError: {
prototype: GPUInternalError;
new (message?: string): GPUInternalError;
};

/** @category GPU */
type GPUErrorFilter = "out-of-memory" | "validation" | "internal";
Expand Down
18 changes: 17 additions & 1 deletion tools/deno.lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions tools/generate_types_deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// This script is used to generate the @types/deno package on DefinitelyTyped.

import $ from "jsr:@david/[email protected]";
import { Node, Project } from "jsr:@ts-morph/ts-morph@23.0.0";
import { type NamedNode, Node, Project } from "jsr:@ts-morph/ts-morph@27.0.0";
import * as semver from "jsr:@std/[email protected]";

const rootDir = $.path(import.meta.dirname!).parentOrThrow();
Expand Down Expand Up @@ -54,23 +54,23 @@ async function createDenoDtsFile() {
);

for (const statement of file.getStatementsWithComments()) {
if (Node.isCommentStatement(statement)) {
const statementText = statement.getText();
if (statementText.includes("<reference")) {
statement.remove();
continue;
}
if (Node.isCommentNode(statement)) {
statement.remove();
continue;
}
const shouldKeepKeep = (Node.isModuleDeclaration(statement) ||
Node.isInterfaceDeclaration(statement) ||
Node.isTypeAliasDeclaration(statement) ||
Node.isClassDeclaration(statement)) &&
(matchesAny(statement.getName(), [
const shouldKeepNode = (namedNode: NamedNode) => {
return matchesAny(namedNode.getName(), [
"Deno",
]) || statement.getName()?.startsWith("GPU"));
if (!shouldKeepKeep) {
]) || namedNode.getName()?.startsWith("GPU");
};
if (Node.isVariableStatement(statement)) {
for (const decl of statement.getDeclarations()) {
if (!shouldKeepNode(decl)) {
decl.remove();
}
}
} else if (!shouldKeepNode(statement)) {
statement.remove();
continue;
}
}

Expand Down
Loading