ts2fable
ts2fable copied to clipboard
Issues with flatpickr
I'll (probably, don't depend on it ...) try to fix it myself when I have some time, in a month or two.
- 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
- missing generic params

- missing type
Record<'X, 'Y>

- invalid generics

- duplicated entries in enum

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:

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

