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

282
Views
Clases dinámicas de TypeScript (para usar al final como patrón de repositorio con Axios)

Me sugirieron usar esa forma de definir tipos (en Nuxt.js para todos los componentes manualmente y al final, los datos se cargarán con Axios usando el "Patrón de repositorio"). Para proyectos pequeños está bien, pero ¿qué pasa con proyectos grandes con múltiples datos, tipos, etc.? ¿Hay alguna forma de automatizarlo? ¿Puedo tener algún tipo de clases mecanografiadas "dinámicas"?

Algunos datos:

 export const samplePage = [ { buttons: [ { size: 1, text: "Some text" } ] } ]

samplePage.modelo.ts

 export class Button { size: number; text: string; constructor(button: Partial<Button> = {}) { this.size = 1; this.text = ""; } }

prueba.vue

 <template> <div> </div> </template> <script lang="ts"> import { SamplePage } from "@/classes/models/samplePage.model" import Vue from 'vue' export default Vue.extend({ data() { return { samplePage: samplePage } }, mounted() { console.log("debug: samplePage", new SamplePage(this.samplePage[0])) }, methods: { } }) </script> <style lang="scss" scoped> </style>
about 4 years ago · Juan Pablo Isaza
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!