Skip to content

Fix typescript field component compatibility - #597

Open
RZetko wants to merge 1 commit into
ratiw:nextfrom
RZetko:RZetko-fix-typescript-field-component-compatibility
Open

Fix typescript field component compatibility#597
RZetko wants to merge 1 commit into
ratiw:nextfrom
RZetko:RZetko-fix-typescript-field-component-compatibility

Conversation

@RZetko

@RZetko RZetko commented Feb 15, 2019

Copy link
Copy Markdown

In Typescript, export of Vue component returns typeof(field.name) = function instead of object. This causes issues when trying to use field components, because fieldName.replace in VuetableColGroup only checks for object type and returns "fieldName.replace is not a function".

Example method signature that causes issues:

import { Vue } from 'vue-property-decorator';

export default class VuetableCustomCheckbox extends Vue {
  ...
}

Example import and use in another file:

import { Vue } from 'vue-property-decorator';
import Vuetable from 'vuetable-2/src/components/Vuetable.vue';
import VuetableCustomCheckbox from '@/vuetable/VuetableCustomCheckbox.vue';

@Component({
  name: 'custom-vue-table',
  components: {
    Vuetable,
    VuetableCustomCheckbox,
  },

  export default class TicketsTable extends Vue {
    private fields: TableFieldItem[] = [
      {
        name: VuetableCustomCheckbox,
        title: '',
        sortField: null,
        titleClass: 'text-xs-left',
        dataClass: 'text-xs-left',
      } as Object,
    ]
  }
})

In Typescript, export of Vue component returns type = function by default. This causes issues when trying to use field components because fieldName.replace in VuetableColGroup only checks for object type and returns "fieldName.replace is not a function".

Example method signature that causes issues:

export default class VuetableCustomCheckbox extends Vue {
  ...
}
@nathanstanford2

Copy link
Copy Markdown

I am having the same issue as described above. +1 to merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants