Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run new generates broken template with TypeScript errors #2872

Closed
martinpitt opened this issue Nov 8, 2024 · 1 comment · Fixed by #2873
Closed

npm run new generates broken template with TypeScript errors #2872

martinpitt opened this issue Nov 8, 2024 · 1 comment · Fixed by #2873
Labels
bug priority: low Severity level: 3

Comments

@martinpitt
Copy link
Contributor

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.

@martinpitt martinpitt added bug priority: low Severity level: 3 labels Nov 8, 2024
martinpitt added a commit to martinpitt/patternfly-elements that referenced this issue Nov 8, 2024
Commit c9bd577 enabled `isolatedDeclarations`, which introduced these
errors in `npm new` generated components:

> TS9008: Method must have an explicit return type annotation with --isolatedDeclarations.
> render() {
>
> TS9017: Only const arrays can be inferred with --isolatedDeclarations.
> static readonly styles = [styles];

Fixes patternfly#2872
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug priority: low Severity level: 3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@martinpitt and others