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

[BUG] angular-formio 4.6.7 fails to compile with typescript type error #489

Closed
bh-adrienne opened this issue Mar 11, 2020 · 7 comments
Closed
Labels

Comments

@bh-adrienne
Copy link

Environment

Please provide as many details as you can:

  • Hosting type
    • [] Form.io
    • [x ] Local deployment
      • Version:
  • Formio.js version: 4.9.0-rc.7
  • Frontend framework: Angular v 7.2.16
  • Browser:
  • Browser version:

Steps to Reproduce

  1. Upgraded package.json in my Angular 7 project to latest angular-formio 4.6.7 with formio.js 4.9.0-rc.7 using 'npm install'
  2. Tried to run 'ng serve' to compile project.

Expected behavior

Modules compile.

Observed behavior

The following compile error:

ERROR in node_modules/angular-formio/grid/GridHeaderComponent.d.ts(9,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/angular-formio/grid/form/FormGridHeader.component.d.ts(5,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/angular-formio/grid/grid.component.d.ts(44,9): error TS1086: An accessor cannot be declared in an ambient context.

ℹ 「wdm」: Failed to compile.

This issue does NOT happen with angular 4.5.8 and formio.js 4.9.0-rc.7.

@bh-adrienne
Copy link
Author

This looks like it might be a typescript version problem similar to what is described here:
storybookjs/storybook#9463

Should angular-formio dependencies for typescript version be documented or put in package.json?

@travist
Copy link
Member

travist commented Mar 11, 2020

Sure... if you make a pull request, we will look at accepting it.

@bh-adrienne
Copy link
Author

I should have been more clear on this, it doesn't look like the issue is based on the Changelog and package.json: no explicit typescript upgrade occurred between 4.5.8 and 4.6.7.

Instead the issue points to the generated files being generated with the wrong version of typescript during your build process (which I don't think I can submit a PR for.) Specifically, I get errors from these 3 files:
ERROR in node_modules/angular-formio/grid/GridHeaderComponent.d.ts(9,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/angular-formio/grid/grid.component.d.ts(44,9): error TS1086: An accessor cannot be declared in an ambient context. node_modules/angular-formio/grid/form/FormGridHeader.component.d.ts(5,9): error TS1086: An accessor cannot be declared in an ambient context.

What I suspect is that the .d.ts files for these items were generated with Typescript 3.7, instead of the files previously generated with Typescript 3.6 (since that upgrade did occur in Angular-formio 4.6.x). For whatever reason, that makes the generated files now incompatible with my project, running on Typescript 3.2.4

I can't upgrade my entire application to a higher version of Typescript to solve a dependency issue like this one: my project is Angular 7 based and Angular 7 requires typescript between v3.1 and v3.3. This issue effectively causes a complete Angular 7 support drop completely starting at Angular Form.io 4.6. If this was the intention, then THAT is what someone on your team needs to document. If it isn't, then the types.d files for the project need to be generated differently in the build step for angular-formio before release.

@travist
Copy link
Member

travist commented Mar 20, 2020

Oh I see... this is what I feared because up until now we have been able to have all versions of Angular supported with a single release. This may mean that we will need to recompile the version with an older version of typescript and have a "special" version for older Angular versions. The only other thing that I can think of is can we compile this version with an older typescript and will that run in Angular 9 without errors? I would prefer to have a single build that works for all, so your input in this would be helpful if you think that would work.

@blochealth
Copy link

Followup here: my team ended up migrating to Angular 9 for other reasons. Don't know if this is still an issue.

@travist
Copy link
Member

travist commented Aug 5, 2020

We will be migrating this library to Angular 9/10 within the next couple of weeks.

@Sidiro23
Copy link

Sidiro23 commented Feb 7, 2024

We're currently addressing a backlog of GitHub issues, and as part of this effort, some inactive issues may be marked as closed. This isn't a dismissal, but a step toward more efficient tracking.

If you feel the issue is still relevant, please re-open and we'll ensure it gets the attention it deserves. Your understanding is appreciated as we work to enhance our open-source responsiveness.

@Sidiro23 Sidiro23 closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants