module.d.ts

  1. // Type definitions for [~THE LIBRARY NAME~] [~OPTIONAL VERSION NUMBER~]
  2. // Project: [~THE PROJECT NAME~]
  3. // Definitions by: [~YOUR NAME~] <[~A URL FOR YOU~]>
  4. /*~ This is the module template file. You should rename it to index.d.ts
  5. *~ and place it in a folder with the same name as the module.
  6. *~ For example, if you were writing a file for "super-greeter", this
  7. *~ file should be 'super-greeter/index.d.ts'
  8. */
  9. /*~ If this module is a UMD module that exposes a global variable 'myLib' when
  10. *~ loaded outside a module loader environment, declare that global here.
  11. *~ Otherwise, delete this declaration.
  12. */
  13. export as namespace myLib;
  14. /*~ If this module has methods, declare them as functions like so.
  15. */
  16. export function myMethod(a: string): string;
  17. export function myOtherMethod(a: number): number;
  18. /*~ You can declare types that are available via importing the module */
  19. export interface someType {
  20. name: string;
  21. length: number;
  22. extras?: string[];
  23. }
  24. /*~ You can declare properties of the module using const, let, or var */
  25. export const myField: number;
  26. /*~ If there are types, properties, or methods inside dotted names
  27. *~ of the module, declare them inside a 'namespace'.
  28. */
  29. export namespace subProp {
  30. /*~ For example, given this definition, someone could write:
  31. *~ import { subProp } from 'yourModule';
  32. *~ subProp.foo();
  33. *~ or
  34. *~ import * as yourMod from 'yourModule';
  35. *~ yourMod.subProp.foo();
  36. */
  37. export function foo(): void;
  38. }