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

I am getting error when I use multipleSelect . "Cannot find type definition file for 'trusted-types'. " #1313

Closed
5 tasks done
roopeshkurian opened this issue Nov 12, 2023 · 9 comments

Comments

@roopeshkurian
Copy link

Describe the bug

I attempted to upgrade Angular-Slickgrid to the most recent version. Then I tried to run/build the project. But its giving me the following errors.

Error: node_modules/multiple-select-vanilla/dist/types/interfaces/interfaces.d.ts:1:23 - error TS2688: Cannot find type definition file for 'trusted-types'.

1 ///
~~~~~~~~~~~~~

Error: node_modules/multiple-select-vanilla/dist/types/interfaces/interfaces.d.ts:47:44 - error TS2304: Cannot find name 'TrustedHTML'.

                                          ~~~~~~~~~~~
                                          ~~~~~~~~~~~

Error: node_modules/multiple-select-vanilla/dist/types/interfaces/multipleSelectOption.interface.d.ts:1:23 - error TS2688: Cannot find type definition file for 'trusted-types'.

1 ///
~~~~~~~~~~~~~

Error: node_modules/multiple-select-vanilla/dist/types/interfaces/multipleSelectOption.interface.d.ts:174:44 - error TS2304: Cannot find name 'TrustedHTML'.

174 sanitizer?: (html: string) => string | TrustedHTML;
~~~~~~~~~~~it is

Reproduction

If you upgrade to the latest version, you may encounter this error. If you did not get this issue, I can create a sample project for your reference.

Expectation

There should not be any error from the node_modules folder.

Environment Info

Angular 17.0.2
Angular-Slickgrid 6.5.0
Typescript 5.2.2
Browsers: Mozilla, Chrome, Edge
System Windows 11

Validations

@roopeshkurian
Copy link
Author

After I installed @types/dompurify, everything started working properly again.

@ghiscoding
Copy link
Owner

oh ok thanks for the feedback, I will make @types/dompurify a dependency of multiple-select-vanilla lib which I had a new release last week. I'll do that tomorrow, thanks for letting me know

@ghiscoding
Copy link
Owner

There was a request in TypeScript to make trusted-types part of the DOM API but it's been open for couple years without much traction in this TypeScript issue. Can you try @types/trusted-types instead? I think I will use that type instead of the DOMPurify one since that is what they are suggesting to use in that TypeScript issue.

@roopeshkurian
Copy link
Author

I have removed DOMPurify and installed @types/trusted-types. Its working well. Thank you for your suggestion.

@ghiscoding
Copy link
Owner

Great thanks again for confirming, I will release a new version tomorrow to include it has a dependency so you won't need to install it yourself. :)

@roopeshkurian
Copy link
Author

roopeshkurian commented Nov 13, 2023

Thank you so much for your support. Adding to dependency will be helpful.

I have another request (Not important).
We are using momentjs . Can we think about implementing Luxon instead of Moment?

@ghiscoding
Copy link
Owner

ghiscoding commented Nov 13, 2023

We are using momentjs . Can we think about implementing Luxon instead of Moment?

No I tried other lib like DayJS and date-fns to replace moment but they are all missing a little something, most of them don't have the Z for Zulu for UTC date and TZ date format. so 2 years ago I decided to wait for Temporal to come out which will become part of EcmaScript and I tought it would have been out 2 years ago but it is really slow to finish that implementation but it does look like it's finally coming in the next few months since I think they finally closed the big roadblock they had, I'm watching this Temporal roadmap, I'm hopefull it will be part of ES2024

And by the way, I'm using moment-mini instead of moment because it's a lot smaller since it only includes the English locale and that is ok for my libs since I only use strict date format and I'm not using any of its locale functionalities.

So in short, I'm not interested to move to other libs, I wanted to do that couple years ago but didn't find good libraries to migrate to since they are all missing something. However at this point Temporal is coming really soon and it will be part of the browser eventually, so I think that is the way to go, we just need to be patient and wait. However, I know that for the beginning we'll have to use a polyfill but I still prefer to wait for the official Temporal release or what they call Stage 4 (it's currently at Stage 3), hopefully soon.

@roopeshkurian
Copy link
Author

I agree with you. Thank you for providing a thorough explanation.

ghiscoding pushed a commit that referenced this issue Nov 13, 2023
- update to latest Slickgrid-Universal which has the following 2 changes
  1. add missing `@types/trusted-types` deps, fixes issue #1313
  2. Slickgrid-Universal has improved types exports for TS Types discovery as can be shown in https://arethetypeswrong.github.io/?p=%40slickgrid-universal%2Fcommon%403.5.1
@ghiscoding
Copy link
Owner

ghiscoding commented Nov 13, 2023

closed by PR #1314 and available in v6.5.1, don't forget to update both Angular-Slickgrid and Slickgrid-Universal dependencies if you have any

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

No branches or pull requests

2 participants