Skip to content

garybernhardt/preact-typescript-component-wont-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  1. yarn install --pure-lockfile
  2. tsc
  3. Why does it do this?
$ tsc
src/mycomponent.ts:5:14 - error TS2345: Argument of type 'typeof MyComponent2' is not assignable to parameter of type 'string'.

5     return h(MyComponent2, {})
  1. Answer: because MyComponent isn't passing the required prop foo to MyComponent2. Change it to this and it will work:
export class MyComponent extends Component<{}, {}> {
  render() {
    return h(MyComponent2, {foo: 1})
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published