Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // model_1.ts file
- export class Model_1{
- foo(): number {}
- }
- // model.ts file
- declare function require(moduleName:string):any;
- import {Model_1 as zip } from './model_1';
- if (true){
- let IntModel: typeof zip = require('./model_1')
- let modelInstance = new IntModel();
- const output = modelInstance.foo()
- }
- //Dynamic Module Loading in Node.js
- declare function require(moduleName: string): any;
- import { ZipCodeValidator as Zip } from "./ZipCodeValidator";
- if (needZipValidation) {
- let ZipCodeValidator: typeof Zip = require("./ZipCodeValidator");
- let validator = new ZipCodeValidator();
- if (validator.isAcceptable("...")) { /* ... */ }
- }
- {
- "compilerOptions": {
- "module": "commonjs",
- "noImplicitAny": true,
- "sourceMap": true,
- "removeComments": true,
- "preserveConstEnums": true,
- "declaration": true,
- "target": "es5",
- "lib": ["es2015", "dom"],
- "outDir": "./dist",
- "noUnusedLocals": true,
- "noImplicitReturns": true,
- "noImplicitThis": true,
- "noUnusedParameters": false,
- "pretty": true,
- "noFallthroughCasesInSwitch": true,
- "allowUnreachableCode": false
- }
Add Comment
Please, Sign In to add comment