Posts

Showing posts from December, 2022

understanding index.d.ts file

 Recently while debugging one of my code repository, I encountered this error: Warning: (ae-forgotten-export) The symbol "Unavailable" needs to be exported by the entry point index.d.ts To give more context here Unavailable is an interface introduced by me as a sub-object of an already exported interface. So, let's first understand what does this index.d.ts signify: Searching over the web it was seen than *.d.ts files are like header files which are used to store JS code for typescript usage. If you are coming from c world this is like .h file. This mechanism allows to use JS code in TS env without any conversion. e.g. import {Hello} from './Apple/index' If we have both index.ts and index.d.ts files typescript compiler will look for index.d.ts file So, let's jump back to this error, this Unavailable interface needs to be exported form index.d.ts file I see inside index.ts file

Learning typescript

 Recently, I have changed up my team and moved to a team which is extensively using typescript language. So, naturally I have to learn it up. In this post I would be discussing about my learnings: What is Typescript? Typescript is built on the top of JavaScript. It is type superset of JavaScript which compiles back to simple JavaScript. It provides object-oriented features like java and c# and is also statically typed. For those who don't know what is statically typed it means that variables are declared with their types at the time of their declaration. Hmmm.... That's interesting so I assume it's a programming layer which is built on the top of JavaScript and provides object-oriented features of statically typed languages and compiling back to JavaScript. Hence, bringing functionalities of both JS and object-oriented languages together. Installation Let's start with discussing installation of typescript. I am assuming that you might be having node js installed over yo...