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

Improve type support for ts #645 #646

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

Conversation

Freymaurer
Copy link

Closes #645

Transpiling Feliz ReactComponent to typescript:

    [<ReactComponent(true)>]
    static member TermSearch(
        onTermSelect: Term option -> unit,
        term: Term option,
        ?parentId: string,
        ?termSearchQueries: ResizeArray<string * SearchCall>,
        ?parentSearchQueries: ResizeArray<string * ParentSearchCall>,
        ?allChildrenSearchQueries: ResizeArray<string * AllChildrenSearchCall>,
        ?advancedSearch: U2<AdvancedSearch, bool>,
        ?onFocus: unit -> Fable.Core.JS.Promise<unit>,
        ?onBlur: unit -> Fable.Core.JS.Promise<unit>,
        ?onKeyDown: Browser.Types.KeyboardEvent -> Fable.Core.JS.Promise<unit>,
        ?showDetails: bool,
        ?debug: bool,
        ?disableDefaultSearch: bool,
        ?disableDefaultParentSearch: bool,
        ?disableDefaultAllChildrenSearch: bool,
        ?portalTermSelectArea: IRefValue<option<HTMLElement>>,
        ?fullwidth: bool, ?autoFocus: bool,
        ?classNames: TermSearchStyle
    ) =

would normally become:

export function TermSearch(termSearchInputProps: any): ReactElement {

with my changes will become:

export function TermSearch(termSearchInputProps: { onTermSelect: ((arg0: Option<Term>) => void), term?: Term, parentId?: string, termSearchQueries?: [string, ((arg0: string) => Promise<Term[]>)][], parentSearchQueries?: [string, ((arg0: [string, string]) => Promise<Term[]>)][], allChildrenSearchQueries?: [string, ((arg0: string) => Promise<Term[]>)][], advancedSearch?: { form: ((arg0: { cancel: (() => void), startSearch: (() => void) }) => ReactElement), search: (() => Promise<Term[]>) } | boolean, onFocus?: (() => Promise<void>), onBlur?: (() => Promise<void>), onKeyDown?: ((arg0: KeyboardEvent) => Promise<void>), showDetails?: boolean, debug?: boolean, disableDefaultSearch?: boolean, disableDefaultParentSearch?: boolean, disableDefaultAllChildrenSearch?: boolean, portalTermSelectArea?: IRefValue$1<Option<HTMLElement>>, fullwidth?: boolean, autoFocus?: boolean, classNames?: TermSearchStyle }): ReactElement {

let me know what you think @MangelMaxime @Zaid-Ajaj . I would really appreciate this change 🙂

@MangelMaxime
Copy link
Contributor

Generated code seems ok to me

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.

[<ReactComponent>] in typescript will always transpile args to any
2 participants