Skip to content

Commit 773585a

Browse files
authored
[w3c-image-capture] Align types to match output from TypeScript-DOM-lib-generator (DefinitelyTyped#72685)
1 parent 1e6fc1f commit 773585a

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

types/node/test/globals-dom.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
{
6161
const stream = new ReadableStream<string>({ start: (controller) => controller.enqueue("hello") }); // $ExpectType ReadableStream<string>
6262
const compressionStream = new CompressionStream("gzip");
63-
const encodedStream = stream.pipeThrough(new TextEncoderStream()); // $ExpectType ReadableStream<Uint8Array> || ReadableStream<Uint8Array<ArrayBufferLike>>
64-
const compressedStream = encodedStream.pipeThrough(compressionStream); // $ExpectType ReadableStream<any> || ReadableStream<Uint8Array<ArrayBufferLike>>
65-
compressedStream.pipeThrough(new DecompressionStream("gzip")); // $ExpectType ReadableStream<any> || ReadableStream<Uint8Array<ArrayBufferLike>>
63+
const encodedStream = stream.pipeThrough(new TextEncoderStream()); // $ExpectType ReadableStream<Uint8Array> || ReadableStream<Uint8Array<ArrayBufferLike>> || ReadableStream<Uint8Array<ArrayBuffer>>
64+
const compressedStream = encodedStream.pipeThrough(compressionStream); // $ExpectType ReadableStream<any> || ReadableStream<Uint8Array<ArrayBufferLike>> || ReadableStream<Uint8Array<ArrayBuffer>>
65+
compressedStream.pipeThrough(new DecompressionStream("gzip")); // $ExpectType ReadableStream<any> || ReadableStream<Uint8Array<ArrayBufferLike>> || ReadableStream<Uint8Array<ArrayBuffer>>
6666
void (async () => {
6767
const reader = compressedStream.getReader();
6868
const readNext = async () => {

types/three/test/integration/three-examples/webgl2_rendertarget_texture2darray.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function init() {
139139

140140
new THREE.FileLoader().setResponseType("arraybuffer").load("textures/3d/head256x256x109.zip", data => {
141141
const zip = unzipSync(new Uint8Array(data as ArrayBuffer));
142-
const array = new Uint8Array(zip["head256x256x109"].buffer);
142+
const array = new Uint8Array(zip["head256x256x109"].buffer as ArrayBuffer);
143143

144144
const texture = new THREE.DataArrayTexture(array, DIMENSIONS.width, DIMENSIONS.height, DIMENSIONS.depth);
145145
texture.format = THREE.RedFormat;

types/three/test/unit/examples/jsm/exporters/STLExporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ function exportASCII() {
1111
}
1212

1313
function exportBinary() {
14-
const result = exporter.parse(mesh, { binary: true });
15-
saveArrayBuffer(result, "box.stl");
14+
const result = exporter.parse(mesh, { binary: true }); // $ExpectType DataView || DataView<ArrayBufferLike>
15+
saveArrayBuffer(result as BufferSource, "box.stl");
1616
}
1717

1818
const link = document.createElement("a");

types/w3c-image-capture/index.d.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/// <reference types="webrtc" />
22

3-
declare class ImageCapture {
4-
constructor(videoTrack: MediaStreamTrack);
5-
3+
interface ImageCapture {
64
takePhoto(photoSettings?: PhotoSettings): Promise<Blob>;
75

86
getPhotoCapabilities(): Promise<PhotoCapabilities>;
@@ -14,29 +12,31 @@ declare class ImageCapture {
1412
readonly track: MediaStreamTrack;
1513
}
1614

15+
declare var ImageCapture: {
16+
prototype: ImageCapture
17+
new(videoTrack: MediaStreamTrack): ImageCapture;
18+
}
19+
1720
interface PhotoCapabilities {
18-
readonly redEyeReduction: RedEyeReduction;
19-
readonly imageHeight: MediaSettingsRange;
20-
readonly imageWidth: MediaSettingsRange;
21-
readonly fillLightMode: FillLightMode[];
21+
redEyeReduction?: "never" | "always" | "controllable";
22+
imageHeight?: MediaSettingsRange;
23+
imageWidth?: MediaSettingsRange;
24+
fillLightMode?: ("auto" | "off" | "flash")[];
2225
}
2326

2427
interface PhotoSettings {
25-
fillLightMode?: FillLightMode | undefined;
28+
fillLightMode?: "auto" | "off" | "flash" | undefined;
2629
imageHeight?: number | undefined;
2730
imageWidth?: number | undefined;
2831
redEyeReduction?: boolean | undefined;
2932
}
3033

3134
interface MediaSettingsRange {
32-
readonly max: number;
33-
readonly min: number;
34-
readonly step: number;
35+
max?: number;
36+
min?: number;
37+
step?: number;
3538
}
3639

37-
type RedEyeReduction = "never" | "always" | "controllable";
38-
type FillLightMode = "auto" | "off" | "flash";
39-
4040
interface MediaTrackCapabilities {
4141
whiteBalanceMode: MeteringMode[];
4242
exposureMode: MeteringMode[];
@@ -85,7 +85,7 @@ interface MediaTrackConstraintSet {
8585
}
8686

8787
interface MediaTrackSettings {
88-
whiteBalanceMode?: MeteringMode | undefined;
88+
whiteBalanceMode?: string | undefined;
8989
exposureMode?: MeteringMode | undefined;
9090
focusMode?: MeteringMode | undefined;
9191
pointsOfInterest?: Point2D[] | undefined;

types/w3c-image-capture/w3c-image-capture-tests.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const updateCameraPanZoomTiltAndTakePhoto = async () => {
2121

2222
// Map it to a slider element.
2323
const input = <HTMLInputElement> document.getElementById(ptz);
24-
input.min = capabilities[ptz].min.toString();
25-
input.max = capabilities[ptz].max.toString();
26-
input.step = capabilities[ptz].step.toString();
24+
input.min = capabilities[ptz].min!.toString();
25+
input.max = capabilities[ptz].max!.toString();
26+
input.step = capabilities[ptz].step!.toString();
2727
const settingsPtz = settings[ptz];
2828
input.value = (settingsPtz && settingsPtz.toString()) || "0";
2929
input.disabled = false;
@@ -155,9 +155,9 @@ const updateFocusAndTrakePhoto = () => {
155155

156156
// Map focus distance to a slider element.
157157
const input = <HTMLInputElement> document.querySelector("input[type=\"range\"]");
158-
input.min = capabilities.focusDistance.min.toString();
159-
input.max = capabilities.focusDistance.max.toString();
160-
input.step = capabilities.focusDistance.step.toString();
158+
input.min = capabilities.focusDistance.min!.toString();
159+
input.max = capabilities.focusDistance.max!.toString();
160+
input.step = capabilities.focusDistance.step!.toString();
161161
const focusDistance = track.getSettings().focusDistance;
162162
input.value = (focusDistance && focusDistance.toString()) || "0";
163163

0 commit comments

Comments
 (0)