Share via

It's possible define a new Type using values from environment.ts?

tunemy15 1 Reputation point
2021-06-24T09:50:14.957+00:00

So, I have this into environment.ts:

export const common = {
    TYPES_COOL: ['cool0','cool1','cool2'] 
}

And wanna use this values to define a new type into myCoolModel.model.ts:

import { common } from 'environment.ts';
export type MyType =   common.TYPES_COOL[0] | common.TYPES_COOL[1] | common.TYPES_COOL[2];

But Visual Code launch error -> Cannot find namespace 'common'.

It's possible define new types using values from environment.ts ?

Community Center | Not monitored
0 comments No comments

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,201 Reputation points Microsoft External Staff
    2021-06-24T11:56:51.21+00:00

    Hi @tunemy15 ,

    It seems that you are using Visual Studio Code, which is different from Visual Studio. The tag “vs-setup” is related to Visual Studio, for more questions about Visual Studio Code, we suggest you post it to the GitHub-vscode forum where you would get support for this product.

    Thanks for your understanding.

    Sincerely,
    Anna

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.