Home > OS >  VS Code & TypeScript hover over a type
VS Code & TypeScript hover over a type

Time:12-13

I have been using typescript in vs code and I pretty new to typescript. when I hover an Express type, I get a lot of stuff in a pop up. I really don't understand where it is coming from. I tried to trace it back, but I am guessing is a built in method in the packages... does anyone know what these are?

import GetServerSideProps

enter image description here

CodePudding user response:

Second pop up is more detail type definition. It represents that Request type in Express utilizes some other types as Generics(types between <>). Generics is general concept in many strictly typed languages. Main purpose of Generics is to add more flexibility in defining data types in strictly typed languages and to delay choosing exact data type for later.

If you are not familiar with it I recommend you reading this article about generics in typescript: generics in TS

  • Related