patternfly / patternfly-elements

PatternFly Elements. A set of community-created web components based on PatternFly design.
https://patternflyelements.org/
MIT License
379 stars 96 forks source link

npm run new generates broken template with TypeScript errors #2872

Closed martinpitt closed 2 weeks ago

martinpitt commented 2 weeks ago

Description of the issue

The npm run new generator is documented to produce a working template component. However, it doesn't.

Steps to reproduce

  1. npm run new
  2. npm start

Expected behavior

Component compiles and works.

Actual behaviour

TODOs] Generated in 0.9676713880000002s
⠸
❌ [build:elements] exited with exit code 1. Output:

elements/pf-cool-element/pf-cool-element.ts:12:28 - error TS9017: Only const arrays can be inferred with --isolatedDeclarations.

12   static readonly styles = [styles];
                              ~~~~~~~~

  elements/pf-cool-element/pf-cool-element.ts:12:19
    12   static readonly styles = [styles];
                         ~~~~~~
    Add a type annotation to the property styles.

elements/pf-cool-element/pf-cool-element.ts:14:3 - error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations.

14   render() {
     ~~~~~~

  elements/pf-cool-element/pf-cool-element.ts:14:3
    14   render() {
         ~~~~~~
    Add a return type to the method

Found 2 errors.

❌ 1 script failed.                                         

This shouldn't be hard to fix. I'll look at it as part of Day of Learning.