diff --git a/types/css-font-loading-module/css-font-loading-module-tests.ts b/types/css-font-loading-module/css-font-loading-module-tests.ts index 08fd976397..52556a03a6 100644 --- a/types/css-font-loading-module/css-font-loading-module-tests.ts +++ b/types/css-font-loading-module/css-font-loading-module-tests.ts @@ -4,11 +4,11 @@ const font = new FontFace("Example", "url(...)", { }); font.load(); font.loaded.then((fontFace: FontFace) => { - fontFace.status - fontFace.family + fontFace.status; + fontFace.family; }, (fontFace: FontFace) => {}); const a: boolean = document.fonts.check("12px Example"); const b: boolean = document.fonts.check("12px Example", "ß"); const c: Promise = document.fonts.load("12px MyFont", "ß").then(); -const d: Promise = document.fonts.ready.then(); \ No newline at end of file +const d: Promise = document.fonts.ready.then(); diff --git a/types/css-font-loading-module/index.d.ts b/types/css-font-loading-module/index.d.ts index d458cfcd7b..0406ed1e36 100644 --- a/types/css-font-loading-module/index.d.ts +++ b/types/css-font-loading-module/index.d.ts @@ -3,61 +3,59 @@ // Definitions by: slikts // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error' -type FontFaceSetLoadStatus = 'loading' | 'loaded' -type BinaryData = ArrayBuffer | ArrayBufferView -type EventHandler = (event: Event) => void +type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error'; +type FontFaceSetLoadStatus = 'loading' | 'loaded'; +type BinaryData = ArrayBuffer | ArrayBufferView; +type EventHandler = (event: Event) => void; interface FontFaceDescriptors { - style?: string - weight?: string - stretch?: string - unicodeRange?: string - variant?: string - featureSettings?: string + style?: string; + weight?: string; + stretch?: string; + unicodeRange?: string; + variant?: string; + featureSettings?: string; } interface FontFaceSet extends Set { // events for when loading state changes - onloading: EventHandler - onloadingdone: EventHandler - onloadingerror: EventHandler + onloading: EventHandler; + onloadingdone: EventHandler; + onloadingerror: EventHandler; // check and start loads if appropriate // and fulfill promise when all loads complete - load(font: string, text?: string): Promise + load(font: string, text?: string): Promise; // return whether all fonts in the fontlist are loaded // (does not initiate load if not available) - check(font: string, text?: string): boolean + check(font: string, text?: string): boolean; // async notification that font loading and layout operations are done - readonly ready: Promise + readonly ready: Promise; // loading state, "loading" while one or more fonts loading, "loaded" otherwise - readonly status: FontFaceSetLoadStatus + readonly status: FontFaceSetLoadStatus; } declare global { - interface FontFace { - new (family: string, source: string | BinaryData, descriptors?: FontFaceDescriptors): FontFace - load(): Promise + class FontFace { + constructor(family: string, source: string | BinaryData, descriptors?: FontFaceDescriptors); + load(): Promise; - family: string - style: string - weight: string - stretch: string - unicodeRange: string - variant: string - featureSettings: string - readonly status: FontFaceLoadStatus - readonly loaded: Promise + family: string; + style: string; + weight: string; + stretch: string; + unicodeRange: string; + variant: string; + featureSettings: string; + readonly status: FontFaceLoadStatus; + readonly loaded: Promise; } interface Document { - fonts: FontFaceSet + fonts: FontFaceSet; } - - var FontFace: FontFace } -export {} \ No newline at end of file +export {};