Generic type 'Layer<SourceType, RendererType>' requires 2 type argument(s).
See original GitHub issueDescribe the bug After upgrading our lib to use ol@6.10.0 or ol@6.11.0, the build fails with the above-mentioned errors.
Error: projects/hslayers/src/components/utils/layer-utils.service.ts:408:27 - error TS2314: Generic type 'Layer<SourceType, RendererType>' requires 2 type argument(s).
408 isLayerClustered(layer: Layer<Source>): boolean {
etc.
Our lib is based on Angular (i.e. TypeScript).
There is a question from my side, rather then a direct bug report, whether there was some undocumented breaking change happening between versions 6.9 and 6.10?
To Reproduce Steps to reproduce the behavior:
- Use openlayers in a TS application
- Use
Layer<Source>
as a type - Compile the app and see error
Expected behavior No breaking changes when upgrading between minor-releases.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Generic type 'ControlProps' requires 2 type argument(s). ...
This error is actually originating from a lot of types I've used from @types/react-select including NoticeProps, OptionProps, ValueType, etc. I' ...
Read more >Generic type 'ElementRef' requires 2 type argument(s)
I updated typescript from 2.7.2 to 2.9.2 (global and local) and the error is not showing anymore. I think the solutions posted in...
Read more >Type.MakeGenericType(Type[]) Method (System)
A Type representing the constructed type formed by substituting the elements of typeArguments for the type parameters of the current generic type.
Read more >ts2314: generic type 'ɵɵdirectivedeclaration' requires 6 ...
Angular 9 Ivy - Generic type 'ɵɵFactoryDef' requires 2 type argument(s) Generic type 'Observable<T>' requires 1 type argument Injecting services in custom ...
Read more >Generic type 'Promise<T, R>' requires 2 type argument
This question is locked. New answers and comments are not allowed. ... I'm working on a NavtiveScript project (Typescript-based). On my local ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @jmacura. I just created #13291, which will fix this issue. No generic types for Layer are required any more, but you may set a Source type (or even a Renderer type, which probably does not make sense in most cases) if you wish.
Apologies for this. Since this change is not a breaking change for JavaScript users, we did not increase the major version. Also see “API change policy” on https://openlayers.org/en/latest/apidoc/.
This change was made for avoiding type casts in the library, and we had not considered the implications for TypeScript users. Ideally, this change would not have had a user facing impact.