Template:
<div class="main">
<ng-container *ngFor="let threshold of durationThreshold | keyvalue"></ng-container>
</div>
Component:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'AngularTest';
public durationThreshold : Record<string, {
timeInSeconds: number | undefined,
unit: string
}> = {}
constructor() {
}
}
Keyvalue source code (From angular source):
export declare class KeyValuePipe implements PipeTransform {
private readonly differs;
constructor(differs: KeyValueDiffers);
private differ;
private keyValues;
private compareFn;
transform<K, V>(input: ReadonlyMap<K, V>, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>>;
transform<K extends number, V>(input: Record<K, V>, compareFn?: (a: KeyValue<string, V>, b: KeyValue<string, V>) => number): Array<KeyValue<string, V>>;
transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V>, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>>;
transform(input: null | undefined, compareFn?: (a: KeyValue<unknown, unknown>, b: KeyValue<unknown, unknown>) => number): null;
transform<K, V>(input: ReadonlyMap<K, V> | null | undefined, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>> | null;
transform<K extends number, V>(input: Record<K, V> | null | undefined, compareFn?: (a: KeyValue<string, V>, b: KeyValue<string, V>) => number): Array<KeyValue<string, V>> | null;
transform<K extends string, V>(input: Record<K, V> | ReadonlyMap<K, V> | null | undefined, compareFn?: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number): Array<KeyValue<K, V>> | null;
static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<KeyValuePipe, never>;
static ɵpipe: ɵngcc0.ɵɵPipeDeclaration<KeyValuePipe, "keyvalue">;
}
IntelliJ is reporting the following error in template:
Argument type Record<string, {timeInSeconds: number | undefined, unit: string}> is not assignable to parameter type ReadonlyMap<unknown, unknown>
From the keyvalue source code it should match the third overload. What am I missing?
CodePudding user response:
The issue is tracked at WEB-51209, please follow it for updates