import { DatePipe } from '@angular/common';
declare global {
interface Date {
transformTo(format: string): string;
}
}
Date.prototype.transformTo = function(format: string): string{
return new DatePipe('en-US').transform(this, format);
};
export {};
Results in the error:
Property "transformTo" does not exist on type 'Date'.
I've looked at several S.O. posts and everything looks right. When I have a Date intellisense know the extension method and what it expects. The vs code doesn't show an error. The error only occurs when running 'ng build'
Angular version: 9.1.11
Node Version: 14.8.0
NPM Version: 6.14.15