ModusCreateOrg / ionic-vue

Vuejs integration for Ionic versions 4 and 5
MIT License
271 stars 26 forks source link

add props and better typing to defineContainer and other factory functions #123

Closed michaeltintiuc closed 4 years ago

michaeltintiuc commented 4 years ago

Add Prop type to FunctionalComponent generic and add props property to the created component.

Proof of concept:

import { FunctionalComponent, h } from 'vue';
import { keys } from 'ts-transformer-keys';
import { JSX } from '@ionic/core';

export const defineContainer = (name: string) => {
  const Container: FunctionalComponent<JSX.SomeComponent> = (props, { slots }) =>
    h(name, props, slots.default && slots.default());

  Container.displayName = name;
  Container.props = keys<JSX.SomeComponent>();

  return Container;
};

See this library and it's guide on updates to rollup config: https://github.com/kimamula/ts-transformer-keys