Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
¿Cuál es el formato de tipo de interfaz en angular cli?

Estaba mirando los documentos y me perdí.

ng generate interface <name> <type>

Sin embargo, no dice qué poner en el tipo. ¿Es solo una cadena, objeto, matriz, etc. o puedo especificar propiedades como email:String username:String age:Number ?

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

ng generar generará

nombre de archivo <name>.<type>.ts contenido:

 export interface <name> { //camel case }

es decir

ng generate interface Itest sometype genera el nombre de archivo itest.sometype.ts contenido

 export interface Itest { }
about 4 years ago · Santiago Trujillo Report

0

Usando Angular CLI ,

 ng gi filename

creará un archivo con el nombre filename.ts y tendrá el nombre de archivo de la interfaz de exportación filename {} en él

about 4 years ago · Santiago Trujillo Report

0

Al igual que :

 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; }

Deberá exportar la interfaz que desea usar en su archivo mecanografiado después de eso:

 export interface test{ listComputedDatas: GraphDatas; }

Y en tu código:

 import {test} from './pathToInterface'; ... randomProperty: test; // Typescript should detect properties such as // randomProperty.listComputedDatas.internalTemperature.min

EDITAR: será más rápido creando su propio archivo manualmente que haciendo el comando angular-cli ...

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!