Extend (Update) third-party old type declaration interface with new one

If you need to overwrite an existing property declaration to change the type, you’ll need to fork the @types/expo types.

The easiest way is probably to copy the index.d.ts file into your typings directory and uninstall the original @types/expo package. Or you can use a tool such as Braid (disclosure: I am a Braid contributor) to import the types/expo/index.d.ts file directly from the DefinitelyTyped repository; this has the advantage that it’s easy to merge upstream updates with your own modifications, but this may not matter to you if DefinitelyTyped is going to be updated soon anyway.

Either way, you have the option to adjust your baseUrl and paths options so that module resolution finds your index.d.ts file or to create a package.json for your modified @types/expo package and register it as a dependency in your main package.json using a relative path.

Leave a Comment