@@ -463,6 +463,14 @@ interface Element {
463
463
remove ( ) : Element ;
464
464
removeAndKeepContent ( ) : Element ;
465
465
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 ;
466
474
}
467
475
468
476
declare class Event {
@@ -778,32 +786,29 @@ interface JsonWebKey {
778
786
* Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
779
787
* making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
780
788
*/
781
- interface KVNamespace {
789
+ interface KVNamespace < K extends string = string > {
782
790
get (
783
- key : string ,
791
+ key : K ,
784
792
options ?: Partial < KVNamespaceGetOptions < undefined > >
785
793
) : Promise < string | null > ;
786
- get ( key : string , type : "text" ) : Promise < string | null > ;
794
+ get ( key : K , type : "text" ) : Promise < string | null > ;
787
795
get < ExpectedValue = unknown > (
788
- key : string ,
796
+ key : K ,
789
797
type : "json"
790
798
) : 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 > ;
797
802
get < ExpectedValue = unknown > (
798
803
key : string ,
799
804
options : KVNamespaceGetOptions < "json" >
800
805
) : Promise < ExpectedValue | null > ;
801
806
get (
802
- key : string ,
807
+ key : K ,
803
808
options : KVNamespaceGetOptions < "arrayBuffer" >
804
809
) : Promise < ArrayBuffer | null > ;
805
810
get (
806
- key : string ,
811
+ key : K ,
807
812
options : KVNamespaceGetOptions < "stream" >
808
813
) : Promise < ReadableStream | null > ;
809
814
list < Metadata = unknown > (
@@ -818,44 +823,44 @@ interface KVNamespace {
818
823
* await NAMESPACE.put(key, value)
819
824
*/
820
825
put (
821
- key : string ,
826
+ key : K ,
822
827
value : string | ArrayBuffer | ArrayBufferView | ReadableStream ,
823
828
options ?: KVNamespacePutOptions
824
829
) : Promise < void > ;
825
830
getWithMetadata < Metadata = unknown > (
826
- key : string ,
831
+ key : K ,
827
832
options ?: Partial < KVNamespaceGetOptions < undefined > >
828
833
) : Promise < KVNamespaceGetWithMetadataResult < string , Metadata > > ;
829
834
getWithMetadata < Metadata = unknown > (
830
- key : string ,
835
+ key : K ,
831
836
type : "text"
832
837
) : Promise < KVNamespaceGetWithMetadataResult < string , Metadata > > ;
833
838
getWithMetadata < ExpectedValue = unknown , Metadata = unknown > (
834
- key : string ,
839
+ key : K ,
835
840
type : "json"
836
841
) : Promise < KVNamespaceGetWithMetadataResult < ExpectedValue , Metadata > > ;
837
842
getWithMetadata < Metadata = unknown > (
838
- key : string ,
843
+ key : K ,
839
844
type : "arrayBuffer"
840
845
) : Promise < KVNamespaceGetWithMetadataResult < ArrayBuffer , Metadata > > ;
841
846
getWithMetadata < Metadata = unknown > (
842
- key : string ,
847
+ key : K ,
843
848
type : "stream"
844
849
) : Promise < KVNamespaceGetWithMetadataResult < ReadableStream , Metadata > > ;
845
850
getWithMetadata < Metadata = unknown > (
846
- key : string ,
851
+ key : K ,
847
852
options : KVNamespaceGetOptions < "text" >
848
853
) : Promise < KVNamespaceGetWithMetadataResult < string , Metadata > > ;
849
854
getWithMetadata < ExpectedValue = unknown , Metadata = unknown > (
850
- key : string ,
855
+ key : K ,
851
856
options : KVNamespaceGetOptions < "json" >
852
857
) : Promise < KVNamespaceGetWithMetadataResult < ExpectedValue , Metadata > > ;
853
858
getWithMetadata < Metadata = unknown > (
854
- key : string ,
859
+ key : K ,
855
860
options : KVNamespaceGetOptions < "arrayBuffer" >
856
861
) : Promise < KVNamespaceGetWithMetadataResult < ArrayBuffer , Metadata > > ;
857
862
getWithMetadata < Metadata = unknown > (
858
- key : string ,
863
+ key : K ,
859
864
options : KVNamespaceGetOptions < "stream" >
860
865
) : Promise < KVNamespaceGetWithMetadataResult < ReadableStream , Metadata > > ;
861
866
delete ( name : string ) : Promise < void > ;
@@ -930,7 +935,7 @@ interface ReadResult {
930
935
done : boolean ;
931
936
}
932
937
933
- interface ReadableByteStreamController {
938
+ declare abstract class ReadableByteStreamController {
934
939
readonly byobRequest : ReadableStreamBYOBRequest | null ;
935
940
readonly desiredSize : number | null ;
936
941
close ( ) : void ;
@@ -950,6 +955,12 @@ declare class ReadableStream {
950
955
) : ReadableStream ;
951
956
pipeTo ( destination : WritableStream , options ?: PipeToOptions ) : Promise < void > ;
952
957
tee ( ) : [ ReadableStream , ReadableStream ] ;
958
+ values (
959
+ options ?: ReadableStreamValuesOptions
960
+ ) : AsyncIterableIterator < ReadableStreamReadResult > ;
961
+ [ Symbol . asyncIterator ] (
962
+ options ?: ReadableStreamValuesOptions
963
+ ) : AsyncIterableIterator < ReadableStreamReadResult > ;
953
964
}
954
965
955
966
declare class ReadableStreamBYOBReader {
@@ -966,14 +977,14 @@ declare class ReadableStreamBYOBReader {
966
977
) : Promise < ReadableStreamReadResult < Uint8Array > > ;
967
978
}
968
979
969
- interface ReadableStreamBYOBRequest {
980
+ declare abstract class ReadableStreamBYOBRequest {
970
981
readonly view : Uint8Array | null ;
971
982
respond ( bytesWritten : number ) : void ;
972
983
respondWithNewView ( view : ArrayBufferView ) : void ;
973
984
readonly atLeast : number | null ;
974
985
}
975
986
976
- interface ReadableStreamDefaultController {
987
+ declare abstract class ReadableStreamDefaultController {
977
988
readonly desiredSize : number | null ;
978
989
close ( ) : void ;
979
990
enqueue ( chunk ?: any ) : void ;
@@ -1020,6 +1031,10 @@ interface ReadableStreamTransform {
1020
1031
readable : ReadableStream ;
1021
1032
}
1022
1033
1034
+ interface ReadableStreamValuesOptions {
1035
+ preventCancel ?: boolean ;
1036
+ }
1037
+
1023
1038
declare class Request extends Body {
1024
1039
constructor ( input : Request | string , init ?: RequestInit | Request ) ;
1025
1040
clone ( ) : Request ;
@@ -1586,7 +1601,7 @@ declare class WritableStream {
1586
1601
getWriter ( ) : WritableStreamDefaultWriter ;
1587
1602
}
1588
1603
1589
- interface WritableStreamDefaultController {
1604
+ declare abstract class WritableStreamDefaultController {
1590
1605
readonly signal : AbortSignal ;
1591
1606
error ( reason ?: any ) : void ;
1592
1607
}
0 commit comments