Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 0dc3fe4

Browse files
autodecl-bot[bot]threepointone
autodecl-bot[bot]
andauthored
Updated types for 2022-01-15 (#181)
* Updated types for 2022-01-15 * run prettier on all files * add a changeset Co-authored-by: autodecl-bot[bot] <91285878+autodecl-bot[bot]@users.noreply.github.com> Co-authored-by: Sunil Pai <[email protected]>
1 parent 771ce75 commit 0dc3fe4

File tree

3 files changed

+267
-44
lines changed

3 files changed

+267
-44
lines changed

.changeset/short-pigs-collect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/workers-types": patch
3+
---
4+
5+
Updated auto-generated types @ 2022-01-15

index.d.ts

+41-26
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,14 @@ interface Element {
463463
remove(): Element;
464464
removeAndKeepContent(): Element;
465465
setInnerContent(content: Content, options?: ContentOptions): Element;
466+
onEndTag(handler: Function): void;
467+
}
468+
469+
interface EndTag {
470+
name: string;
471+
before(content: Content, options?: ContentOptions): EndTag;
472+
after(content: Content, options?: ContentOptions): EndTag;
473+
remove(): EndTag;
466474
}
467475

468476
declare class Event {
@@ -778,32 +786,29 @@ interface JsonWebKey {
778786
* Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
779787
* making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
780788
*/
781-
interface KVNamespace {
789+
interface KVNamespace<K extends string = string> {
782790
get(
783-
key: string,
791+
key: K,
784792
options?: Partial<KVNamespaceGetOptions<undefined>>
785793
): Promise<string | null>;
786-
get(key: string, type: "text"): Promise<string | null>;
794+
get(key: K, type: "text"): Promise<string | null>;
787795
get<ExpectedValue = unknown>(
788-
key: string,
796+
key: K,
789797
type: "json"
790798
): Promise<ExpectedValue | null>;
791-
get(key: string, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
792-
get(key: string, type: "stream"): Promise<ReadableStream | null>;
793-
get(
794-
key: string,
795-
options: KVNamespaceGetOptions<"text">
796-
): Promise<string | null>;
799+
get(key: K, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
800+
get(key: K, type: "stream"): Promise<ReadableStream | null>;
801+
get(key: K, options: KVNamespaceGetOptions<"text">): Promise<string | null>;
797802
get<ExpectedValue = unknown>(
798803
key: string,
799804
options: KVNamespaceGetOptions<"json">
800805
): Promise<ExpectedValue | null>;
801806
get(
802-
key: string,
807+
key: K,
803808
options: KVNamespaceGetOptions<"arrayBuffer">
804809
): Promise<ArrayBuffer | null>;
805810
get(
806-
key: string,
811+
key: K,
807812
options: KVNamespaceGetOptions<"stream">
808813
): Promise<ReadableStream | null>;
809814
list<Metadata = unknown>(
@@ -818,44 +823,44 @@ interface KVNamespace {
818823
* await NAMESPACE.put(key, value)
819824
*/
820825
put(
821-
key: string,
826+
key: K,
822827
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
823828
options?: KVNamespacePutOptions
824829
): Promise<void>;
825830
getWithMetadata<Metadata = unknown>(
826-
key: string,
831+
key: K,
827832
options?: Partial<KVNamespaceGetOptions<undefined>>
828833
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
829834
getWithMetadata<Metadata = unknown>(
830-
key: string,
835+
key: K,
831836
type: "text"
832837
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
833838
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
834-
key: string,
839+
key: K,
835840
type: "json"
836841
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
837842
getWithMetadata<Metadata = unknown>(
838-
key: string,
843+
key: K,
839844
type: "arrayBuffer"
840845
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
841846
getWithMetadata<Metadata = unknown>(
842-
key: string,
847+
key: K,
843848
type: "stream"
844849
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
845850
getWithMetadata<Metadata = unknown>(
846-
key: string,
851+
key: K,
847852
options: KVNamespaceGetOptions<"text">
848853
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
849854
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
850-
key: string,
855+
key: K,
851856
options: KVNamespaceGetOptions<"json">
852857
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
853858
getWithMetadata<Metadata = unknown>(
854-
key: string,
859+
key: K,
855860
options: KVNamespaceGetOptions<"arrayBuffer">
856861
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
857862
getWithMetadata<Metadata = unknown>(
858-
key: string,
863+
key: K,
859864
options: KVNamespaceGetOptions<"stream">
860865
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
861866
delete(name: string): Promise<void>;
@@ -930,7 +935,7 @@ interface ReadResult {
930935
done: boolean;
931936
}
932937

933-
interface ReadableByteStreamController {
938+
declare abstract class ReadableByteStreamController {
934939
readonly byobRequest: ReadableStreamBYOBRequest | null;
935940
readonly desiredSize: number | null;
936941
close(): void;
@@ -950,6 +955,12 @@ declare class ReadableStream {
950955
): ReadableStream;
951956
pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
952957
tee(): [ReadableStream, ReadableStream];
958+
values(
959+
options?: ReadableStreamValuesOptions
960+
): AsyncIterableIterator<ReadableStreamReadResult>;
961+
[Symbol.asyncIterator](
962+
options?: ReadableStreamValuesOptions
963+
): AsyncIterableIterator<ReadableStreamReadResult>;
953964
}
954965

955966
declare class ReadableStreamBYOBReader {
@@ -966,14 +977,14 @@ declare class ReadableStreamBYOBReader {
966977
): Promise<ReadableStreamReadResult<Uint8Array>>;
967978
}
968979

969-
interface ReadableStreamBYOBRequest {
980+
declare abstract class ReadableStreamBYOBRequest {
970981
readonly view: Uint8Array | null;
971982
respond(bytesWritten: number): void;
972983
respondWithNewView(view: ArrayBufferView): void;
973984
readonly atLeast: number | null;
974985
}
975986

976-
interface ReadableStreamDefaultController {
987+
declare abstract class ReadableStreamDefaultController {
977988
readonly desiredSize: number | null;
978989
close(): void;
979990
enqueue(chunk?: any): void;
@@ -1020,6 +1031,10 @@ interface ReadableStreamTransform {
10201031
readable: ReadableStream;
10211032
}
10221033

1034+
interface ReadableStreamValuesOptions {
1035+
preventCancel?: boolean;
1036+
}
1037+
10231038
declare class Request extends Body {
10241039
constructor(input: Request | string, init?: RequestInit | Request);
10251040
clone(): Request;
@@ -1586,7 +1601,7 @@ declare class WritableStream {
15861601
getWriter(): WritableStreamDefaultWriter;
15871602
}
15881603

1589-
interface WritableStreamDefaultController {
1604+
declare abstract class WritableStreamDefaultController {
15901605
readonly signal: AbortSignal;
15911606
error(reason?: any): void;
15921607
}

0 commit comments

Comments
 (0)