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

After TypeScript update some methods are not found in node modules #5715

Open
Gayasosos opened this issue Jul 29, 2024 · 7 comments
Open

After TypeScript update some methods are not found in node modules #5715

Gayasosos opened this issue Jul 29, 2024 · 7 comments
Assignees

Comments

@Gayasosos
Copy link

Gayasosos commented Jul 29, 2024

When I Updated Angular 17 to 18, I updated TypeScript to the new version. (5.4.0). After that, errors occurred that could not be found.

Here are the versions i used,

"@formio/angular": "^7.0.0",
"@formio/js": "^5.0.0-rc.39",
"formiojs": "^4.19.5",
"typescript": "~5.4.0"

Screenshots
image

Errors

Error: node_modules/@formio/js/lib/cjs/utils/formUtils.d.ts:20:86 - error TS2304: Cannot find name 'AsyncComponentDataCallback'.

20 export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise;
~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@formio/js/lib/cjs/utils/formUtils.d.ts:21:46 - error TS2304: Cannot find name 'Component'.

21 export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
~~~~~~~~~

Error: node_modules/@formio/js/lib/cjs/utils/formUtils.d.ts:21:65 - error TS2304: Cannot find name 'DataObject'.

21 export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
~~~~~~~~~~

Error: node_modules/@formio/js/lib/cjs/utils/formUtils.d.ts:21:81 - error TS2304: Cannot find name 'ComponentDataCallback'.

21 export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
~~~~~~~~~~~~~~~~~~~~~
etc...

@lane-formio
Copy link
Contributor

If you are using angular 18, then you should be using formio/[email protected]
Also, formio/js is up to 5.0.0-rc.68 now which might show some improvement.
The 5.0.0 release of formio/js is now at the forefront of our development priorities so I'd be interested to know if these changes resolve this particular behavior.

@Gayasosos
Copy link
Author

Hi @lane-formio,

Error count was decrease but Issue was not completely fixed by above solution. Some errors are still.

"@formio/angular": "^8.0.0-rc.6",
"@formio/js": "^5.0.0-rc.68",
 "formiojs": "^4.19.5",
"typescript": "~5.5.4"

  node : 20.16.0

Errors

./src/app/modules/configuration/form-builder/form-builder.component.ts:3:0-36 - Error: Module not found: Error: Can't resolve '@formio/js' in 'D:\Angular Update 18\ososerp\Web\src\app\modules\configuration\form-builder'

./node_modules/@formio/angular/fesm2022/formio-angular.mjs:3:0-74 - Error: Module not found: Error: Can't resolve '@formio/js' in 'D:\Angular Update 18\ososerp\Web\node_modules@formio\angular\fesm2022'

Error: node_modules/@formio/angular/core.d.ts:14:71 - error TS2307: Cannot find module '@formio/deprecated-types' or its corresponding type declarations.

14 export { ComponentSchema, ExtendedComponentSchema, ElementInfo } from '@formio/deprecated-types';
~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@formio/angular/formio.common.d.ts:1:58 - error TS2307: Cannot find module '@formio/deprecated-types' or its corresponding type declarations.

1 import { ExtendedComponentSchema, ValidateOptions } from '@formio/deprecated-types';
~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: src/app/modules/configuration/form-builder/form-builder.component.ts:208:12 - error TS2339: Property 'builder' does not exist on type 'typeof Formio'.

208 Formio.builder(dom, form, { ...options }).then((builder: any) => {

@lane-formio
Copy link
Contributor

Next thing I would suggest is removing formiojs.
@formio/js is the new namespace for our open source renderer.

@iabu94
Copy link

iabu94 commented Sep 4, 2024

Hi @lane-formio , good day to you, we have updated everything that you have suggested, but the @formio/angular package is internally referring to @formio/deprecated types, which is throwing these exceptions, could you please help me out to sort this?

image

@cvetelinandreevdreamix
Copy link

After installing "@formio/deprecated-types": "^0.1.0", to package.json the error changes to

Error: node_modules/@formio/core/lib/error/FieldError.d.ts:1:35 - error TS2307: Cannot find module 'types' or its corresponding type declarations.

1 import { ValidationContext } from 'types';

Interestingly, the types is there (in @formio/core) but I can't get why it can't find it. I guess I'll have to stick to angular 17 until this is fixed.

@abu-osos
Copy link

After installing "@formio/deprecated-types": "^0.1.0", to package.json the error changes to

Error: node_modules/@formio/core/lib/error/FieldError.d.ts:1:35 - error TS2307: Cannot find module 'types' or its corresponding type declarations.

1 import { ValidationContext } from 'types';

Interestingly, the types is there (in @formio/core) but I can't get why it can't find it. I guess I'll have to stick to angular 17 until this is fixed.

+1, couldn't move to v18 because of this

@hackerman-azds
Copy link

After installing "@formio/deprecated-types": "^0.1.0", to package.json the error changes to
Error: node_modules/@formio/core/lib/error/FieldError.d.ts:1:35 - error TS2307: Cannot find module 'types' or its corresponding type declarations.
1 import { ValidationContext } from 'types';
Interestingly, the types is there (in @formio/core) but I can't get why it can't find it. I guess I'll have to stick to angular 17 until this is fixed.

+1, couldn't move to v18 because of this

Could you pls share your package.json or the versions you use for v17? I'm having these errors in v7.0 and above and I feel I have to guess by try/error, it's frustrating since the documentation doesn't say which version is compatible to each other.

Thanks in advance, @abu-osos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants