简体   繁体   中英

VS Code & TypeScript hover over a type

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

在此处输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM