Typescript error: Property 'children' is missing in type but required in type 'CommonProps'

JD Fill

First time seeing an error like this so please bear with me.

I was working on a project and opened one file to make a change. I opened the file, didn't actually make any change and just formatted the file using Prettier.

Right when it formatted, the project threw the error below:

TypeScript error in C:/Users/name/source/repos/UsedEquipment/src/pages/listings/sections/SearchResultListings.tsx(253,16):
Type '{ style: { height: string; }; type: "rect"; ready: false; showLoadingAnimation: true; }' is not assignable to type '(IntrinsicAttributes & CommonProps & { color?: string | undefined; rows?: number | undefined; showLoadingAnimation?: boolean | undefined; customPlaceholder?: undefined; } & Pick<...> & { ...; } & { ...; }) | ... 4 more ... | (IntrinsicAttributes & ... 2 more ... & { ...; })'.
  Property 'children' is missing in type '{ style: { height: string; }; type: "rect"; ready: false; showLoadingAnimation: true; }' but required in type 'CommonProps'.  TS2322

Here's the code where the error's thrown:

showPlaceholders() {
    let items: Object[] = [];
    for (let i = 0; i < ITEMSPERPAGE; i++) {
      //show # of placeholders
      items.push(
        <div
          className="productwrap col-xs-12 col-sm-4 col-md-4 col-lg-3 placeholder"
          key={i}
        >
          <div className="product-wrapper">
            <div className="product-image">
              <ReactPlaceholder
              ^ Error thrown here
                style={{ height: "180px" }}
                type="rect"
                ready={false}
                showLoadingAnimation={true}
              ></ReactPlaceholder>
            </div>
            <div className="product-info-column">
              <ReactPlaceholder
              ^ Error thrown here
                type="text"
                rows={6}
                ready={false}
                showLoadingAnimation={true}
              ></ReactPlaceholder>
            </div>
          </div>
        </div>
      );
    }
    return items;
  }

I'm not entirely sure what this error means or how to fix it. Any idea?

mahieyin-rahmun

React Placeholder expects one child component. Pass in any valid html tag inside it.

<ReactPlaceholder { /*...your other optional props */ }>
  <MyComponent /> {/* this is mandatory */ }
</ReactPlaceholder>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Typescript Error: Property 'mapType' is missing in type '{}'

From Dev

React + Typescript: Property * is missing in type *

From Java

Property 'profileStore' is missing in type '{}' but required in type 'Readonly<AppProps>'.ts(2741)

From Dev

TypeScript ReactDOM Property 'type' is missing on component

From Dev

React with Typescript: property map is missing for type

From Dev

Are typescript type definitions required?

From Dev

Typescript Material UI Property 'classes' is missing in type for MUI component

From Dev

React-Navigation and TypeScript. Property 'getScreen' is missing in type

From Dev

"The 'og:type' property is required, but not present." error, despite correct HTML

From Dev

Declaring object of arrays in Typescript; getting error Type '{}' missing the following properties

From Dev

Declaring object of arrays in Typescript; getting error Type '{}' missing the following properties

From Dev

Typescript error: A private property is missing?

From Dev

Error: missing type specifier

From Dev

Property 'XYZ' is missing in type CustomModel[]

From Java

JavaScript type script Property 0 is missing in type []

From Dev

Typescript: Index signature is missing in type

From Dev

Typescript conditional type missing properties

From Dev

Typescript compile error: Property 'classList' does not exist on type 'Node'

From Dev

How to avoid typescript error: Property 'innerHTML' does not exist on type 'Element'

From Dev

Typescript error: Property 'value' does not exist on type 'Observable<any>'

From Java

useRef Typescript error: Property 'current' does not exist on type 'HTMLElement'

From Dev

Public property of exported class is using private type error in TypeScript

From Dev

Typescript Error TS2339: Property 'project' does not exist on type '{}'

From Dev

Typescript compile error: Property 'bodyParser' does not exist on type 'typeof e'

From Dev

TypeScript Build Error : Property does not exist on type 'IStateParamsService'

From Dev

Typescript Directives error "Property IScope dont exist on type 'IAngularStatic"

From Dev

TypeScript throws error "Property 'breadcrumb' does not exist on type 'Data'."

From Dev

Ionic TypeScript Error (Property 'nav' does not exist on type 'HomePage')

From Dev

Ionic 3 TypeScript Error - Property 'then' does not exist on type 'void'

Related Related

  1. 1

    Typescript Error: Property 'mapType' is missing in type '{}'

  2. 2

    React + Typescript: Property * is missing in type *

  3. 3

    Property 'profileStore' is missing in type '{}' but required in type 'Readonly<AppProps>'.ts(2741)

  4. 4

    TypeScript ReactDOM Property 'type' is missing on component

  5. 5

    React with Typescript: property map is missing for type

  6. 6

    Are typescript type definitions required?

  7. 7

    Typescript Material UI Property 'classes' is missing in type for MUI component

  8. 8

    React-Navigation and TypeScript. Property 'getScreen' is missing in type

  9. 9

    "The 'og:type' property is required, but not present." error, despite correct HTML

  10. 10

    Declaring object of arrays in Typescript; getting error Type '{}' missing the following properties

  11. 11

    Declaring object of arrays in Typescript; getting error Type '{}' missing the following properties

  12. 12

    Typescript error: A private property is missing?

  13. 13

    Error: missing type specifier

  14. 14

    Property 'XYZ' is missing in type CustomModel[]

  15. 15

    JavaScript type script Property 0 is missing in type []

  16. 16

    Typescript: Index signature is missing in type

  17. 17

    Typescript conditional type missing properties

  18. 18

    Typescript compile error: Property 'classList' does not exist on type 'Node'

  19. 19

    How to avoid typescript error: Property 'innerHTML' does not exist on type 'Element'

  20. 20

    Typescript error: Property 'value' does not exist on type 'Observable<any>'

  21. 21

    useRef Typescript error: Property 'current' does not exist on type 'HTMLElement'

  22. 22

    Public property of exported class is using private type error in TypeScript

  23. 23

    Typescript Error TS2339: Property 'project' does not exist on type '{}'

  24. 24

    Typescript compile error: Property 'bodyParser' does not exist on type 'typeof e'

  25. 25

    TypeScript Build Error : Property does not exist on type 'IStateParamsService'

  26. 26

    Typescript Directives error "Property IScope dont exist on type 'IAngularStatic"

  27. 27

    TypeScript throws error "Property 'breadcrumb' does not exist on type 'Data'."

  28. 28

    Ionic TypeScript Error (Property 'nav' does not exist on type 'HomePage')

  29. 29

    Ionic 3 TypeScript Error - Property 'then' does not exist on type 'void'

HotTag

Archive