ts2fable icon indicating copy to clipboard operation
ts2fable copied to clipboard

Issues with flatpickr

Open 0x53A opened this issue 6 years ago • 2 comments

I'll (probably, don't depend on it ...) try to fix it myself when I have some time, in a month or two.

  1. Note: the documentation for -e could be improved, I didn't realize at first that I could add the package name of the first package.
yarn add flatpickr
ts2fable node_modules/flatpickr/dist/typings.d.ts src/Bindings/FlatPickr/FlatPickr.fs -e flatpickr
  1. missing generic params

grafik

  1. missing type Record<'X, 'Y>

grafik

  1. invalid generics

grafik

  1. duplicated entries in enum

grafik

0x53A avatar Mar 04 '19 22:03 0x53A

Record is apparently a TS native Dictionary type:

https://www.rickcarlino.com/2017/02/27/real-world-use-case-for-typescript-record-types.html


The plugin stuff may be solvable with anonymous records:

// types/options.d.ts
export declare type Plugin<E = {}> = (fp: Instance & E) => Options;
// plugins/weekSelect/weekSelect.d.ts
import { Plugin } from "../../types/options";
export declare type PlusWeeks = {
    weekStartDay: Date;
    weekEndDay: Date;
};
declare function weekSelectPlugin(): Plugin<PlusWeeks>;

would need to generate a new anonymous record combining the fields of Instance & E: (fp: Instance & E)


arrayify just needs the braces dropped:

grafik

0x53A avatar Mar 04 '19 23:03 0x53A

The generated Options type is useless and would need support for Partial (which at first glance doesn't seem too hard)

grafik

grafik

0x53A avatar Mar 04 '19 23:03 0x53A