You need the declare global
declare global {
interface Window {
fetch:(url: string, options?: {}) => Promise<any>
}
}
This works then:
window.fetch('/blah').then(...);
More Related Contents:
- How to use fetch in TypeScript
- What is “not assignable to parameter of type never” error in TypeScript?
- Expected 3 type arguments but got 1 but it should infer 2 types
- Import class in definition file (*d.ts)
- TypeScript union of string and string literals
- Are strongly-typed functions as parameters possible in TypeScript?
- What does the `is` keyword do in typescript?
- Mapped Types: removing optional modifier
- Why can I avoid excess property check in typescript just by passing a reference to an object to a function rather than the object in its literal form?
- TypeScript: Accept all Object keys that map to a specific type
- Typescript interface default values
- How to configure custom global interfaces (.d.ts files) for TypeScript?
- TypeScript – use correct version of setTimeout (node vs window)
- How to selectively assign from one Partial to another in typescript
- Experimental decorators warning in TypeScript compilation
- A TypeScript GUID class? [closed]
- Using latest JavaScript features in TypeScript, such as ES2018
- How to define an opaque type in TypeScript?
- What is the Record type?
- Mapping tuple-typed value to different tuple-typed value without casts
- TypeScript function return type based on input parameter
- What does “homomorphic mapped type” mean?
- What does “all legal JavaScript is legal TypeScript” mean?
- Declare a type that allows all parts of all levels of another type
- Empty interface allow any object?
- extend and only specify known properties?
- Private “functions” in TypeScript
- RxJs get value from observable
- Why TypeScript lets me add a string and a number? Can I prevent it?
- A way to mark arbitrary strings in Typescript Template Literals