TypeScript: How to add static methods to built-in classes
问题 Is there anyhow anyway to add some static method to types like Date , String , Array , etc? For example I want to add method today to Date class and in JavaScript I can simply add a property to it or maybe I use Object.defineProperty: Date.today = function(){ let date = new Date; date.setHours(0,0,0,0); return date; } Object.defineProperty(Date, 'today', { get() { ... }}); But I didn't find anyway to inform TypeScript about this new static member. Am I missing something or Did I google it the