最佳答案
How can I import all types from certain file?
Let's say I have myClass.ts
and otherClass.ts
.
I want to import all classes from otherClass.ts
.
I've seen few syntaxes for imports.
import ClassA, { ClassB, ClassC } from 'otherClass';
import * as foo from 'otherClass';
import foo = require('otherClass');
import 'rxjs/Rx';
The first needs me to list everything. I'd like to import all types.
The second syntax needs the namespace prefix: foo.ClassA
.
I understand that the last one is TypeScript 1.4, but still supported.
Is there something like the following?
import * from "otherClass";
...
var x = new ClassA()
Also, what's the meaning of the { ... }
and some of the types being outside and some inside?
The documentation doesn't hint anything such.