Extend Type Declarations on TS 3.x

Ilker Guller
2 min readSep 25, 2018


Let’s say you started to work on the fantastic idea. You decided to use typescript and some fancy popular plugins. Then you prepared everything as you want and the project was ready to go. You started to create some components and added them to your page. Everything looks perfect, right? Then you tried to compile the typescript code but BOOM.. you are getting some errors. You checked the all documentation, blogs, forums. Also, you created an issue on GitHub to inform. Everything must work appropriately because all plugin documentations say everything is correct. However, our wonderful friend, typescript, gives an error. Then you realized the type definition of the plugin that you use is old.

If you also get similar stories on typescript, You are in the correct post right now. I searched this problem everywhere but I couldn’t perfect/clean answer for this. So this is my fix for this kind of problems.

Let’s say you are using expo v30, but expo type definition is v27.

- Let’s create Typings folder on your project root.
- Then create another folder as Expo.
- Create a file as index.d.ts inside of Expo.
- Import the old module
- Create new ones


import * as expo from 'expo'; // import your module to extenddeclare module 'expo' { // create new module    // add your new stuff    export var Icon: any;    export var SplashScreen: any;}

So that’s all. In this way, you can extend or change the module as you want. Then you can send these changes to DefinitelyTyped repo for updating that package type definition.



Ilker Guller

The Guy who can write code, manage projects, talk with people, play drums and love blizzard games