Guest User

Untitled

a guest
Oct 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. // model_1.ts file
  2. export class Model_1{
  3.  
  4. foo(): number {}
  5. }
  6.  
  7. // model.ts file
  8. declare function require(moduleName:string):any;
  9. import {Model_1 as zip } from './model_1';
  10.  
  11. if (true){
  12. let IntModel: typeof zip = require('./model_1')
  13. let modelInstance = new IntModel();
  14. const output = modelInstance.foo()
  15. }
  16.  
  17. //Dynamic Module Loading in Node.js
  18. declare function require(moduleName: string): any;
  19.  
  20. import { ZipCodeValidator as Zip } from "./ZipCodeValidator";
  21.  
  22. if (needZipValidation) {
  23. let ZipCodeValidator: typeof Zip = require("./ZipCodeValidator");
  24. let validator = new ZipCodeValidator();
  25. if (validator.isAcceptable("...")) { /* ... */ }
  26. }
  27.  
  28. {
  29. "compilerOptions": {
  30. "module": "commonjs",
  31. "noImplicitAny": true,
  32. "sourceMap": true,
  33. "removeComments": true,
  34. "preserveConstEnums": true,
  35. "declaration": true,
  36. "target": "es5",
  37. "lib": ["es2015", "dom"],
  38. "outDir": "./dist",
  39. "noUnusedLocals": true,
  40. "noImplicitReturns": true,
  41. "noImplicitThis": true,
  42. "noUnusedParameters": false,
  43. "pretty": true,
  44. "noFallthroughCasesInSwitch": true,
  45. "allowUnreachableCode": false
  46. }
Add Comment
Please, Sign In to add comment