Skip to content

[labs/react] createComponent React component style property typescript problem #3021

Closed

Description

@oisinlavery

Description

Overriding the style property on a wrapped component (using createComponent) results in a typescript error.
The error expects all style properties to be set.

Steps to Reproduce

WrappedWebComponent.ts

import { Slider } from "@material/mwc-slider/slider.js";
import { createComponent } from "@lit-labs/react";
import React from "react";

const Component = createComponent(React, "mwc-slider", Slider, {
  oninput: "input",
});

export default Component;

Using component in App.tsx

<WrappedWebComponent
  style={{
    background: "red",
  }}
/>

Typescript Error:

(property) style?: (CSSStyleDeclaration & React.CSSProperties) | undefined
Type '{ background: string; }' is not assignable to type 'CSSStyleDeclaration & CSSProperties'.
  Type '{ background: string; }' is missing the following properties from type 'CSSStyleDeclaration': accentColor, alignContent, alignItems, alignSelf, and 450 more.ts(2322)

Expected Results

Allow overriding of style property

Actual Results

Typescript error, expecting all css properties to be set

  • Vscode
  • Create React App

Activity

  1. changed the title [-][labs/react] [/-] [+][labs/react] createComponent React component style property typescript problem[/+] on Jun 10, 2022
  2. added 6 commits that reference this issue on Jun 16, 2022
    0dfb528
    ca0b193
    06929de
    7a2a6f5
    67154a0
    8251ed9
  3. moved this to 🏥 In Triage in Lit Project Boardon Jun 16, 2022
  4. self-assigned this
    on Jun 21, 2022
  5. taylor-vann commented on Jul 15, 2022

    @taylor-vann
    Contributor

    This issue should be resolved with #3072

    :) curious if that can be confirmed

  6. moved this from 🏥 In Triage to ✅ Done in Lit Project Boardon Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions