Skip to content

Plays badly with cfg attribute #12

@Madoshakalaka

Description

@Madoshakalaka

this works:

#[derive(PartialEq, Properties)]
pub struct FooProps {
    #[cfg(feature = "foo")]
    pub foo: bool,
}


#[function_component]
pub fn Foo(props: &FooProps) -> Html {
    html! {}
}

but this doesn't compile when the cfg is not satisfied:

#[autoprops]
#[function_component]
pub fn Foo(#[cfg(feature = "foo")] foo: bool) -> Html {
    html! {}
}

it fails with

struct `app::FooProps` does not have a field named `foo`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions