module-class.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 for class modules.
  5. *~ You should rename it to index.d.ts 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. /*~ Note that ES6 modules cannot directly export class objects.
  10. *~ This file should be imported using the CommonJS-style:
  11. *~ import x = require('someLibrary');
  12. *~
  13. *~ Refer to the documentation to understand common
  14. *~ workarounds for this limitation of ES6 modules.
  15. */
  16. /*~ If this module is a UMD module that exposes a global variable 'myClassLib' when
  17. *~ loaded outside a module loader environment, declare that global here.
  18. *~ Otherwise, delete this declaration.
  19. */
  20. export as namespace myClassLib;
  21. /*~ This declaration specifies that the class constructor function
  22. *~ is the exported object from the file
  23. */
  24. export = MyClass;
  25. /*~ Write your module's methods and properties in this class */
  26. declare class MyClass {
  27. constructor(someParam?: string);
  28. someProperty: string[];
  29. myMethod(opts: MyClass.MyClassMethodOptions): number;
  30. }
  31. /*~ If you want to expose types from your module as well, you can
  32. *~ place them in this block.
  33. */
  34. declare namespace MyClass {
  35. export interface MyClassMethodOptions {
  36. width?: number;
  37. height?: number;
  38. }
  39. }