Skip to content

Instantly share code, notes, and snippets.

@kurone-kito
Last active June 14, 2019 06:14
Show Gist options
  • Save kurone-kito/ccb4b50181908ae6da2c4b2e8c77c9d1 to your computer and use it in GitHub Desktop.
Save kurone-kito/ccb4b50181908ae6da2c4b2e8c77c9d1 to your computer and use it in GitHub Desktop.
🐥 Example of type solution using d.ts in JavaScript.
/** @type {import("./Piyo").default} */
let x;
let y = new x();
export interface PiyoInstance {
/**
* Thru an argument.
* @param x argument.
* @template T argument type.
*/
instanceMethod<T>(x: T): T;
}
/** 🐥 */
export default interface Piyo {
/** Create the instance. */
new (): PiyoInstance;
/**
* Thru an argument.
* @param x argument.
* @template T argument type.
*/
staticMethod<T>(x: T): T;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment