mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 03:31:47 +00:00
Added typing
This commit is contained in:
Vendored
+8
-32
@@ -1,39 +1,15 @@
|
||||
// Type definitions for word-list-json 0.2
|
||||
// Project: https://github.com/sindresorhus/word-list
|
||||
// Definitions by: My Self <https://github.com/me>
|
||||
// Definitions by: Dovid Meiseles <https://github.com/dovidm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/*~ If this module is a UMD module that exposes a global variable 'myLib' when
|
||||
*~ loaded outside a module loader environment, declare that global here.
|
||||
*~ Otherwise, delete this declaration.
|
||||
*/
|
||||
export as namespace myLib;
|
||||
|
||||
/*~ If this module has methods, declare them as functions like so.
|
||||
*/
|
||||
export function myMethod(a: string): string;
|
||||
export function myOtherMethod(a: number): number;
|
||||
|
||||
/*~ You can declare types that are available via importing the module */
|
||||
export interface someType {
|
||||
name: string;
|
||||
length: number;
|
||||
extras?: string[];
|
||||
interface Lengths {
|
||||
[key: string]: number;
|
||||
}
|
||||
export const words: string[];
|
||||
export const lengths: Lengths;
|
||||
|
||||
/*~ You can declare properties of the module using const, let, or var */
|
||||
export const myField: number;
|
||||
|
||||
/*~ If there are types, properties, or methods inside dotted names
|
||||
*~ of the module, declare them inside a 'namespace'.
|
||||
*/
|
||||
export namespace subProp {
|
||||
/*~ For example, given this definition, someone could write:
|
||||
*~ import { subProp } from 'yourModule';
|
||||
*~ subProp.foo();
|
||||
*~ or
|
||||
*~ import * as yourMod from 'yourModule';
|
||||
*~ yourMod.subProp.foo();
|
||||
*/
|
||||
export function foo(): void;
|
||||
}
|
||||
export default interface Words {
|
||||
words: typeof words & typeof lengths;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user