Skip to content

npm run new generates broken template with TypeScript errors #2872

Description

@martinpitt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions