angular - Uvoz specifičnih tipova s aliasom u typescriptu


Mogu uvoziti specifične tipove kao

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

Mogu uvesti sve tipove iz datoteke s aliasom kao

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

Kako mogu uvesti određene tipove s aliasom, nešto poput

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

Odgovor #1

Najbliža stvar koju možeš učiniti:

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

const MyTypes = {Type1, Type2};