Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

212
Visualizações
What is the interface type format in the angular cli?

I was looking at the docs and became lost.

ng generate interface <name> <type>

However it doesn't tell what to put in for type. Like is it just a string, object, array, etc or can I specify properties like email:String username:String age:Number?

about 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

ng generate will generate

filename <name>.<type>.ts content:

export interface <name> { //camel case

}

ie

ng generate interface Itest sometype generates file name itest.sometype.ts content

export interface Itest {
}
about 4 years ago · Santiago Trujillo Relatório

0

Using Angular CLI,

ng g i filename

will create a file by the name filename.ts and will have export interface filename {} in it

about 4 years ago · Santiago Trujillo Relatório

0

Like so :

interface GraphDatas {
  firstTemperature: Period
  internalTemperature: {
    min: number;
    max: number;
  };
  secondTemperature: Period;
  thresholdAlerts: Threshold;
}

interface Period {
  currentPeriod: number;
  previousPeriod: any;  // TO DO
}

interface Threshold extends Period {
  hasBeenRead: number;
}

You will need to export the interface you want to use in your typescript file after that :

export interface test{
  listComputedDatas: GraphDatas;
}

And in your code :

import {test} from './pathToInterface';

...

randomProperty: test;
// Typescript should detect properties such as 
// randomProperty.listComputedDatas.internalTemperature.min

EDIT : You will be faster creating your own file manually than doing the angular-cli command...

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda