Use path mapping for scoped packages (#19292)

This commit is contained in:
Andy
2017-08-23 13:42:40 -07:00
committed by GitHub
parent d38fdb9146
commit 000eba896f
4 changed files with 139 additions and 142 deletions

View File

@@ -2,106 +2,104 @@
// Project: https://github.com/vimeo/player.js
// Definitions by: Denis Yılmaz <https://github.com/denisyilmaz>, Felix Albert <f.albert.work@icloud.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// tslint:disable-next-line no-single-declare-module
declare module "@vimeo/player" {
function myMethod(a: string): string;
function myOtherMethod(a: number): number;
type CallbackFunction = (...args: any[]) => any;
export function myMethod(a: string): string;
export function myOtherMethod(a: number): number;
interface Error {name: string; message: string; method: string; }
export type CallbackFunction = (...args: any[]) => any;
interface PasswordError extends Error {name: "PasswordError"; message: string; method: string; }
interface PrivacyError extends Error {name: "PrivacyError"; message: string; method: string; }
interface InvalidTrackLanguageError extends Error {name: "InvalidTrackLanguageError"; message: string; method: string; }
interface InvalidTrackError extends Error {name: "InvalidTrackError"; message: string; method: string; }
interface UnsupportedError extends Error {name: "UnsupportedError"; message: string; method: string; }
interface ContrastError extends Error {name: "ContrastError"; message: string; method: string; }
interface InvalidCuePoint extends Error {name: "InvalidCuePoint"; message: string; method: string; }
interface RangeError extends Error {name: "RangeError"; message: string; method: string; }
interface TypeError extends Error {name: "TypeError"; message: string; method: string; }
export interface Error {name: string; message: string; method: string; }
type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | "cuechange" | "cuepoint" | "volumechange" | "error" | "loaded" | string;
type EventCallback = (data: any) => any;
export interface PasswordError extends Error {name: "PasswordError"; message: string; method: string; }
export interface PrivacyError extends Error {name: "PrivacyError"; message: string; method: string; }
export interface InvalidTrackLanguageError extends Error {name: "InvalidTrackLanguageError"; message: string; method: string; }
export interface InvalidTrackError extends Error {name: "InvalidTrackError"; message: string; method: string; }
export interface UnsupportedError extends Error {name: "UnsupportedError"; message: string; method: string; }
export interface ContrastError extends Error {name: "ContrastError"; message: string; method: string; }
export interface InvalidCuePoint extends Error {name: "InvalidCuePoint"; message: string; method: string; }
export interface RangeError extends Error {name: "RangeError"; message: string; method: string; }
export interface TypeError extends Error {name: "TypeError"; message: string; method: string; }
class Player {
constructor(element: HTMLIFrameElement|HTMLElement|string, options: Options);
export type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | "cuechange" | "cuepoint" | "volumechange" | "error" | "loaded" | string;
export type EventCallback = (data: any) => any;
on(event: EventName, callback: EventCallback): void;
off(event: EventName, callback?: EventCallback): void;
loadVideo(id: number): VimeoPromise<number, TypeError | PasswordError | PrivacyError | Error>;
ready(): VimeoPromise<void, Error>;
enableTextTrack(language: string, kind?: string): VimeoPromise<VimeoTextTrack, InvalidTrackLanguageError | InvalidTrackError | Error>;
disableTextTrack(): VimeoPromise<void, Error>;
pause(): VimeoPromise<void, PasswordError | PrivacyError |Error>;
play(): VimeoPromise<void, PasswordError | PrivacyError |Error>;
unload(): VimeoPromise<void, Error>;
getAutopause(): VimeoPromise<boolean, UnsupportedError | Error>;
setAutopause(autopause: boolean): VimeoPromise<boolean, UnsupportedError | Error>;
getColor(): VimeoPromise<string, Error>;
setColor(color: string): VimeoPromise<string, ContrastError | TypeError | Error>;
addCuePoint(time: number, data: VimeoCuePointData): VimeoPromise<string, UnsupportedError | RangeError | Error>;
removeCuePoint(id: string): VimeoPromise<string, UnsupportedError | InvalidCuePoint | Error>;
getCuePoints(): VimeoPromise<VimeoCuePoint[], UnsupportedError | Error>;
getCurrentTime(): VimeoPromise<number, Error>;
setCurrentTime(seconds: number): VimeoPromise<number, RangeError | Error>;
getDuration(): VimeoPromise<number, Error>;
getEnded(): VimeoPromise<boolean, Error>;
getLoop(): VimeoPromise<boolean, Error>;
setLoop(loop: boolean): VimeoPromise<boolean, Error>;
getPaused(): VimeoPromise<boolean, Error>;
getTextTracks(): VimeoPromise<VimeoTextTrack[], Error>;
getVideoEmbedCode(): VimeoPromise<string, Error>;
getVideoId(): VimeoPromise<number, Error>;
getVideoTitle(): VimeoPromise<string, Error>;
getVideoWidth(): VimeoPromise<number, Error>;
getVideoHeight(): VimeoPromise<number, Error>;
getVideoUrl(): VimeoPromise<string, PrivacyError | Error>;
getVolume(): VimeoPromise<number, Error>;
setVolume(volume: number): VimeoPromise<number, RangeError | Error>;
}
export class Player {
constructor(element: HTMLIFrameElement|HTMLElement|string, options: Options);
interface VimeoCuePoint {
time: number;
data: VimeoCuePointData;
id: string;
}
interface VimeoCuePointData extends Object {
customKey: string;
}
interface VimeoTextTrack {
language: string;
kind: string;
label: string;
mode?: string;
}
interface Options {
id?: number;
url?: string;
autopause?: boolean;
autoplay?: boolean;
byline?: boolean;
color?: string;
height?: number;
loop?: boolean;
maxheight?: number;
maxwidth?: number;
portrait?: boolean;
title?: boolean;
width?: number;
}
interface VimeoPromise<Result, Reason> extends Promise<Result> {
(
successCallback?: (promiseValue: Result) => void,
rejectCallback?: (reasonValue: Reason) => void
): Promise<Result>;
}
/*~ You can declare properties of the module using const, let, or var */
const playerMap: WeakMap<any, any>;
const readyMap: WeakMap<any, any>;
on(event: EventName, callback: EventCallback): void;
off(event: EventName, callback?: EventCallback): void;
loadVideo(id: number): VimeoPromise<number, TypeError | PasswordError | PrivacyError | Error>;
ready(): VimeoPromise<void, Error>;
enableTextTrack(language: string, kind?: string): VimeoPromise<VimeoTextTrack, InvalidTrackLanguageError | InvalidTrackError | Error>;
disableTextTrack(): VimeoPromise<void, Error>;
pause(): VimeoPromise<void, PasswordError | PrivacyError |Error>;
play(): VimeoPromise<void, PasswordError | PrivacyError |Error>;
unload(): VimeoPromise<void, Error>;
getAutopause(): VimeoPromise<boolean, UnsupportedError | Error>;
setAutopause(autopause: boolean): VimeoPromise<boolean, UnsupportedError | Error>;
getColor(): VimeoPromise<string, Error>;
setColor(color: string): VimeoPromise<string, ContrastError | TypeError | Error>;
addCuePoint(time: number, data: VimeoCuePointData): VimeoPromise<string, UnsupportedError | RangeError | Error>;
removeCuePoint(id: string): VimeoPromise<string, UnsupportedError | InvalidCuePoint | Error>;
getCuePoints(): VimeoPromise<VimeoCuePoint[], UnsupportedError | Error>;
getCurrentTime(): VimeoPromise<number, Error>;
setCurrentTime(seconds: number): VimeoPromise<number, RangeError | Error>;
getDuration(): VimeoPromise<number, Error>;
getEnded(): VimeoPromise<boolean, Error>;
getLoop(): VimeoPromise<boolean, Error>;
setLoop(loop: boolean): VimeoPromise<boolean, Error>;
getPaused(): VimeoPromise<boolean, Error>;
getTextTracks(): VimeoPromise<VimeoTextTrack[], Error>;
getVideoEmbedCode(): VimeoPromise<string, Error>;
getVideoId(): VimeoPromise<number, Error>;
getVideoTitle(): VimeoPromise<string, Error>;
getVideoWidth(): VimeoPromise<number, Error>;
getVideoHeight(): VimeoPromise<number, Error>;
getVideoUrl(): VimeoPromise<string, PrivacyError | Error>;
getVolume(): VimeoPromise<number, Error>;
setVolume(volume: number): VimeoPromise<number, RangeError | Error>;
}
export interface VimeoCuePoint {
time: number;
data: VimeoCuePointData;
id: string;
}
export interface VimeoCuePointData extends Object {
customKey: string;
}
export interface VimeoTextTrack {
language: string;
kind: string;
label: string;
mode?: string;
}
export interface Options {
id?: number;
url?: string;
autopause?: boolean;
autoplay?: boolean;
byline?: boolean;
color?: string;
height?: number;
loop?: boolean;
maxheight?: number;
maxwidth?: number;
portrait?: boolean;
title?: boolean;
width?: number;
}
export interface VimeoPromise<Result, Reason> extends Promise<Result> {
(
successCallback?: (promiseValue: Result) => void,
rejectCallback?: (reasonValue: Reason) => void
): Promise<Result>;
}
/*~ You can declare properties of the module using const, let, or var */
export const playerMap: WeakMap<any, any>;
export const readyMap: WeakMap<any, any>;

View File

@@ -8,11 +8,14 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "types",
"baseUrl": "../",
"typeRoots": [
"types"
],
"types": [],
"paths": {
"@vimeo/player": ["vimeo__player"]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},

View File

@@ -2,61 +2,54 @@
// Project: https://github.com/node-xmpp/node-xmpp/
// Definitions by: PJakcson <https://github.com/PJakcson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3
// TODO: Once TS2.3 is released,
// https://github.com/Microsoft/TypeScript/issues/14819 should be fixed.
// Then, upgrade this package's typescript version to 2.3 and
// Remove the `declare module` wrapper.
// tslint:disable-next-line no-single-declare-module
declare module "@xmpp/jid" {
function createJID(local: string, domain: string, resource: string): JID;
function equal(a: JID, b: JID): boolean;
function is(a: any): boolean;
export function createJID(local: string, domain: string, resource: string): JID;
export function equal(a: JID, b: JID): boolean;
export function is(a: any): boolean;
/**
* Created by marcneumann on 17.02.17.
*/
export class JID {
local: string;
domain: string;
resource: string;
constructor(local: string, domain?: string, resource?: string);
parseJID(jid: string): void;
toString(unescape?: any): string;
/**
* Created by marcneumann on 17.02.17.
* Convenience method to distinguish users
*/
class JID {
local: string;
domain: string;
resource: string;
bare(): JID;
constructor(local: string, domain?: string, resource?: string);
/**
* Comparison function
*/
equals(other: JID): boolean;
parseJID(jid: string): void;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-localpart
*/
setLocal(local: string, escape?: any): void;
toString(unescape?: any): string;
getLocal(unescape?: any): string;
/**
* Convenience method to distinguish users
*/
bare(): JID;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-domain
*/
setDomain(value: string): void;
/**
* Comparison function
*/
equals(other: JID): boolean;
getDomain(): string;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-localpart
*/
setLocal(local: string, escape?: any): void;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-resourcepart
*/
setResource(value: string): void;
getLocal(unescape?: any): string;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-domain
*/
setDomain(value: string): void;
getDomain(): string;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-resourcepart
*/
setResource(value: string): void;
getResource(): string;
}
getResource(): string;
}

View File

@@ -12,6 +12,9 @@
"../"
],
"types": [],
"paths": {
"@xmpp/jid": ["xmpp__jid"]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},