什么是 place

作者: Banzerczhs创建于 2021年9月9日更新于 2023年12月21日

The description of “what is place” in the file module details is rather vague, and I think the translation is not very good. It takes a lot of reading to understand it. **When I mention the place to be checked, I mean that TypeScript will check the following contents at that place (for example, a place for a file called foo): If the place represents a file, such as foo.ts, then congratulations! Otherwise, if the place is a folder and there is a file called foo/index.ts, then congratulations! Otherwise, if the place is a folder and there is a file called package.json that specifies the existence of a file for types, then congratulations! Otherwise, if the place is a folder and there is a file called package.json that specifies the existence of a file for main, then congratulations! In terms of file types, I actually mean .ts, .d.ts, or .js.

内容来源: jkchao/typescript-book-chinese