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

寵の児 提交于 2019-11-27 05:42:00

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!