Import specific types with alias in typescript

Viewed 65

I can import specifc types as

import { Type1, Type2 } from '../../my-file';

I can import all types from a file with alias as

import * as fromApp from '../../../store/app.reducers';

How can I import specific types with alias, something like

import { Type1, Type2 } as MyTypes from '../../my-file'; // of-course, this does not work
1 Answers

The closest thing you can do:

import {Type1, Type2} from '../../my-file';

const MyTypes = {Type1, Type2};
Related