Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typescript field component compatibility #597

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

RZetko
Copy link

@RZetko RZetko commented Feb 15, 2019

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

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