More TS 3.2 DOM updates

Unlike the other PR, these updates should not go in until 3.2 is out,
since they rely on the following additions:

1. webrtc
2. web-animations
3. geometry-dom

I left these packages in to make it easier to upgrade and edited them
where needed, but I removed the dependencies on them in other Definitely
Typed packages.
This commit is contained in:
Nathan Shively-Sanders
2018-11-21 11:34:35 -08:00
parent c8b8c10fce
commit 17af5405cb
6 changed files with 53 additions and 67 deletions
+2 -4
View File
@@ -2,9 +2,7 @@
// Project: http://peerjs.com/
// Definitions by: Toshiya Nakakura <https://github.com/nakakura>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="webrtc" />
// TypeScript Version: 3.2
declare namespace PeerJs{
interface PeerJSOption{
@@ -13,7 +11,7 @@ declare namespace PeerJs{
port?: number;
path?: string;
secure?: boolean;
config?: RTCPeerConnectionConfig;
config?: RTCConfiguration;
debug?: number;
}
+2 -4
View File
@@ -2,9 +2,7 @@
// Project: http://nttcom.github.io/skyway/
// Definitions by: Toshiya Nakakura <https://github.com/nakakura>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="webrtc" />
// TypeScript Version: 3.2
declare namespace PeerJs{
interface PeerJSOption{
@@ -14,7 +12,7 @@ declare namespace PeerJs{
path?: string;
secure?: boolean;
turn?: boolean;
config?: RTCPeerConnectionConfig;
config?: RTCConfiguration;
debug?: number;
}
+2 -4
View File
@@ -2,12 +2,10 @@
// Project: https://www.w3.org/TR/generic-sensor/
// Definitions by: Kenneth Rohde Christiansen <https://github.com/kenchris>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 3.2
// Explainer: https://www.w3.org/TR/motion-sensors/
/// <reference types="geometry-dom" />
declare class SensorErrorEvent extends Event {
constructor(type: string, errorEventInitDict: SensorErrorEventInit);
readonly error: Error;
@@ -82,7 +80,7 @@ declare class UncalibratedMagnetometer extends Sensor {
// Orientation Sensor: https://www.w3.org/TR/orientation-sensor/
type RotationMatrixType = Float32Array | Float64Array | GeometryDom.DOMMatrix;
type RotationMatrixType = Float32Array | Float64Array | DOMMatrix;
declare class OrientationSensor extends Sensor {
readonly quaternion?: number[];
+1 -1
View File
@@ -2,8 +2,8 @@
// Project: https://www.w3.org/TR/screen-orientation/
// Definitions by: Kenneth Rohde Christiansen <https://github.com/kenchris>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.2
type OrientationType = "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
type ScreenOrientationLockType = "any" | "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
interface ScreenOrientation extends EventTarget {
+7 -18
View File
@@ -2,10 +2,10 @@
// Project: https://github.com/web-animations/web-animations-js
// Definitions by: Kristian Moerch <https://github.com/kritollm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.2
type AnimationEffectTimingFillMode = "none" | "forwards" | "backwards" | "both" | "auto";
type AnimationEffectTimingPlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
type AnimationPlayState = "idle" | "running" | "paused" | "finished";
interface AnimationPlaybackEvent {
target: Animation;
@@ -68,18 +68,7 @@ interface ComputedTimingProperties {
currentIteration: number | null;
}
declare class KeyframeEffect implements AnimationEffectReadOnly {
constructor(target: HTMLElement, effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming, id?: string);
activeDuration: number;
onsample: (timeFraction: number | null, effect: KeyframeEffect, animation: Animation) => void | undefined;
parent: KeyframeEffect | null;
target: HTMLElement;
timing: number;
getComputedTiming(): ComputedTimingProperties;
getFrames(): AnimationKeyFrame[];
remove(): void;
}
type AnimationEventListener = (this: Animation, evt: AnimationPlaybackEvent) => any;
type AnimationEventListener = ((this: Animation, evt: AnimationPlaybackEvent) => any) | null;
interface Animation extends EventTarget {
currentTime: number | null;
@@ -88,7 +77,7 @@ interface Animation extends EventTarget {
onfinish: AnimationEventListener;
readonly playState: AnimationPlayState;
playbackRate: number;
startTime: number;
startTime: number | null;
cancel(): void;
finish(): void;
pause(): void;
@@ -96,15 +85,15 @@ interface Animation extends EventTarget {
reverse(): void;
addEventListener(type: "finish" | "cancel", handler: EventListener): void;
removeEventListener(type: "finish" | "cancel", handler: EventListener): void;
effect: AnimationEffectReadOnly;
effect: AnimationEffect | null;
readonly finished: Promise<Animation>;
readonly ready: Promise<Animation>;
timeline: AnimationTimeline;
timeline: AnimationTimeline | null;
}
declare var Animation: {
prototype: Animation;
new(effect?: AnimationEffectReadOnly, timeline?: AnimationTimeline): Animation;
new(effect?: AnimationEffect | null, timeline?: AnimationTimeline | null): Animation;
};
declare class SequenceEffect extends KeyframeEffect {
@@ -118,5 +107,5 @@ interface Element {
getAnimations(): Animation[];
}
interface Document {
timeline: AnimationTimeline;
readonly timeline: AnimationTimeline;
}
+39 -36
View File
@@ -2,6 +2,7 @@
// Project: https://www.w3.org/TR/webrtc/
// Definitions by: Danilo Bargen <https://github.com/dbrgn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.2
//
// W3 Spec: https://www.w3.org/TR/webrtc/
//
@@ -11,8 +12,6 @@
/// <reference path='MediaStream.d.ts' />
type EventHandler = (event: Event) => void;
// https://www.w3.org/TR/webrtc/#idl-def-rtcofferansweroptions
interface RTCOfferAnswerOptions {
voiceActivityDetection?: boolean; // default = true
@@ -28,10 +27,10 @@ interface RTCAnswerOptions extends RTCOfferAnswerOptions {
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcpeerconnectionstate
type RTCPeerConnectionState = 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed';
// type RTCPeerConnectionState = 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed';
// https://www.w3.org/TR/webrtc/#idl-def-rtcicecredentialtype
type RTCIceCredentialType = 'password' | 'token';
// type RTCIceCredentialType = 'password' | 'token';
// https://www.w3.org/TR/webrtc/#idl-def-rtciceserver
interface RTCIceServer {
@@ -40,7 +39,7 @@ interface RTCIceServer {
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtcpmuxpolicy
type RTCRtcpMuxPolicy = 'negotiate' | 'require';
// type RTCRtcpMuxPolicy = 'negotiate' | 'require';
// https://www.w3.org/TR/webrtc/#idl-def-rtciceparameters
interface RTCIceParameters {
@@ -49,6 +48,7 @@ interface RTCIceParameters {
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcicetransport
type IceTransportEventHandler = ((this: RTCIceTransport, ev: Event) => any) | null;
interface RTCIceTransport {
//readonly role: RTCIceRole;
//readonly component: RTCIceComponent;
@@ -59,17 +59,18 @@ interface RTCIceTransport {
getSelectedCandidatePair(): RTCIceCandidatePair | null;
getLocalParameters(): RTCIceParameters | null;
getRemoteParameters(): RTCIceParameters | null;
onstatechange: EventHandler;
ongatheringstatechange: EventHandler;
onselectedcandidatepairchange: EventHandler;
onstatechange: IceTransportEventHandler;
ongatheringstatechange: IceTransportEventHandler;
onselectedcandidatepairchange: IceTransportEventHandler;
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcdtlstransport
type DtlsTransportEventHandler = ((this: RTCDtlsTransport, ev: Event) => any) | null;
interface RTCDtlsTransport {
readonly transport: RTCIceTransport;
//readonly state: RTCDtlsTransportState;
getRemoteCertificates(): ArrayBuffer[];
onstatechange: EventHandler;
onstatechange: DtlsTransportEventHandler;
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpcodeccapability
@@ -79,7 +80,7 @@ interface RTCRtpCodecCapability {
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpheaderextensioncapability
interface RTCRtpHeaderExtensionCapability {
uri: string;
uri?: string;
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpcapabilities
@@ -99,17 +100,17 @@ interface RTCRtpFecParameters {
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcdtxstatus
type RTCDtxStatus = 'disabled' | 'enabled';
// type RTCDtxStatus = 'disabled' | 'enabled';
// https://www.w3.org/TR/webrtc/#idl-def-rtcprioritytype
type RTCPriorityType = 'very-low' | 'low' | 'medium' | 'high';
// type RTCPriorityType = 'very-low' | 'low' | 'medium' | 'high';
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpencodingparameters
interface RTCRtpEncodingParameters {
//ssrc: number;
//rtx: RTCRtpRtxParameters;
//fec: RTCRtpFecParameters;
dtx: RTCDtxStatus;
dtx?: RTCDtxStatus;
//active: boolean;
//priority: RTCPriorityType;
//maxBitrate: number;
@@ -121,7 +122,7 @@ interface RTCRtpEncodingParameters {
interface RTCRtpHeaderExtensionParameters {
//uri: string;
//id: number;
encrypted: boolean;
encrypted?: boolean;
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtcpparameters
@@ -136,7 +137,7 @@ interface RTCRtpCodecParameters {
mimeType: string;
//clockRate: number;
channels?: number; // default = 1
sdpFmtpLine: string;
sdpFmtpLine?: string;
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpparameters
@@ -152,9 +153,9 @@ interface RTCRtpParameters {
// https://www.w3.org/TR/webrtc/#dom-rtcrtpcontributingsource
interface RTCRtpContributingSource {
//readonly timestamp: number;
readonly source: number;
source: number;
//readonly audioLevel: number | null;
readonly voiceActivityFlag: boolean | null;
readonly voiceActivityFlag?: boolean | undefined;
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtpcapabilities
@@ -183,7 +184,7 @@ interface RTCRtpReceiver {
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtptransceiverdirection
type RTCRtpTransceiverDirection = 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive';
// type RTCRtpTransceiverDirection = 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive';
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtptransceiver
interface RTCRtpTransceiver {
@@ -191,7 +192,7 @@ interface RTCRtpTransceiver {
readonly sender: RTCRtpSender;
readonly receiver: RTCRtpReceiver;
readonly stopped: boolean;
readonly direction: RTCRtpTransceiverDirection;
direction: RTCRtpTransceiverDirection;
setDirection(direction: RTCRtpTransceiverDirection): void;
stop(): void;
setCodecPreferences(codecs: RTCRtpCodecCapability[]): void;
@@ -200,8 +201,8 @@ interface RTCRtpTransceiver {
// https://www.w3.org/TR/webrtc/#idl-def-rtcrtptransceiverinit
interface RTCRtpTransceiverInit {
direction?: RTCRtpTransceiverDirection; // default = 'sendrecv'
streams: MediaStream[];
sendEncodings: RTCRtpEncodingParameters[];
streams?: MediaStream[];
sendEncodings?: RTCRtpEncodingParameters[];
}
// https://www.w3.org/TR/webrtc/#dom-rtccertificate
@@ -241,12 +242,13 @@ interface RTCDataChannelInit {
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelstate
type RTCDataChannelState = 'connecting' | 'open' | 'closing' | 'closed';
// type RTCDataChannelState = 'connecting' | 'open' | 'closing' | 'closed';
// https://www.w3.org/TR/websockets/#dom-websocket-binarytype
type RTCBinaryType = 'blob' | 'arraybuffer';
// type RTCBinaryType = 'blob' | 'arraybuffer';
// https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannel
type DataChannelEventHandler<E extends Event> = ((this: RTCDataChannel, ev: E) => any) | null;
interface RTCDataChannel extends EventTarget {
readonly label: string;
readonly ordered: boolean;
@@ -254,33 +256,33 @@ interface RTCDataChannel extends EventTarget {
readonly maxRetransmits: number | null;
readonly protocol: string;
readonly negotiated: boolean;
readonly id: number;
readonly id: number | null;
readonly readyState: RTCDataChannelState;
readonly bufferedAmount: number;
bufferedAmountLowThreshold: number;
binaryType: RTCBinaryType;
binaryType: string;
close(): void;
send(data: string | Blob | ArrayBuffer | ArrayBufferView): void;
onopen: EventHandler;
onmessage: (event: MessageEvent) => void;
onbufferedamountlow: EventHandler;
onerror: (event: ErrorEvent) => void;
onclose: EventHandler;
onopen: DataChannelEventHandler<Event>;
onmessage: DataChannelEventHandler<MessageEvent>;
onbufferedamountlow: DataChannelEventHandler<Event>;
onerror: DataChannelEventHandler<RTCErrorEvent>;
onclose: DataChannelEventHandler<Event>;
}
// https://www.w3.org/TR/webrtc/#h-rtctrackevent
interface RTCTrackEvent extends Event {
readonly receiver: RTCRtpReceiver;
readonly track: MediaStreamTrack;
readonly streams: MediaStream[];
readonly streams: ReadonlyArray<MediaStream>;
readonly transceiver: RTCRtpTransceiver;
}
// https://www.w3.org/TR/webrtc/#h-rtcpeerconnectioniceevent
interface RTCPeerConnectionIceEvent extends Event {
readonly url: string;
readonly url: string | null;
}
// https://www.w3.org/TR/webrtc/#h-rtcpeerconnectioniceerrorevent
@@ -297,6 +299,7 @@ interface RTCDataChannelEvent {
}
// https://www.w3.org/TR/webrtc/#idl-def-rtcpeerconnection
type PeerConnectionEventHandler<E extends Event> = ((this: RTCPeerConnection, ev: E) => any) | null;
interface RTCPeerConnection extends EventTarget {
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>;
createAnswer(options?: RTCAnswerOptions): Promise<RTCSessionDescriptionInit>;
@@ -320,8 +323,8 @@ interface RTCPeerConnection extends EventTarget {
setConfiguration(configuration: RTCConfiguration): void;
close(): void;
onicecandidateerror: (event: RTCPeerConnectionIceErrorEvent) => void;
onconnectionstatechange: EventHandler;
onicecandidateerror: PeerConnectionEventHandler<RTCPeerConnectionIceErrorEvent>;
onconnectionstatechange: PeerConnectionEventHandler<Event>;
// Extension: https://www.w3.org/TR/webrtc/#h-rtcpeerconnection-interface-extensions
getSenders(): RTCRtpSender[];
@@ -330,12 +333,12 @@ interface RTCPeerConnection extends EventTarget {
addTrack(track: MediaStreamTrack, ...streams: MediaStream[]): RTCRtpSender;
removeTrack(sender: RTCRtpSender): void;
addTransceiver(trackOrKind: MediaStreamTrack | string, init?: RTCRtpTransceiverInit): RTCRtpTransceiver;
ontrack: (event: RTCTrackEvent) => void;
ontrack: PeerConnectionEventHandler<RTCTrackEvent>;
// Extension: https://www.w3.org/TR/webrtc/#h-rtcpeerconnection-interface-extensions-1
readonly sctp: RTCSctpTransport | null;
createDataChannel(label: string | null, dataChannelDict?: RTCDataChannelInit): RTCDataChannel;
ondatachannel: (event: RTCDataChannelEvent) => void;
ondatachannel: PeerConnectionEventHandler<RTCDataChannelEvent>;
// Extension: https://www.w3.org/TR/webrtc/#h-rtcpeerconnection-interface-extensions-2
getStats(selector?: MediaStreamTrack | null): Promise<RTCStatsReport>;