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

285
Views
TypeScript Dynamic Classes (to be used at the end as Repository Pattern with Axios)

I've got suggested to use that way to define types (in Nuxt.js for all components manually and at the end, the data will be loaded with Axios using the "Repository Pattern"). For a small projects it's fine, but what about big projects with multiple data, types etc. Is there any way to automate it? Can i have some kind of "dynamic" Typescript classes?

Some data:

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

samplePage.model.ts

export class Button {
    size: number;
    text: string;

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

test.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!