gpt4 book ai didi

TypeScript:是否有类似 __FILE__ 编译器宏的东西?

转载 作者:搜寻专家 更新时间:2023-10-30 20:36:36 25 4
gpt4 key购买 nike

从我知道的其他语言中,__FILE__ 或类似的表达式(例如:在 PHP 中是常量,在 C 中是预处理器宏)被替换为当前源文件路径。 TypeScript 中有这样的东西吗?

最佳答案

如果你正在创建一个节点应用

__dirname

会给你当前的模块目录路径

https://nodejs.org/docs/latest/api/globals.html#globals_dirname

关于TypeScript:是否有类似 __FILE__ 编译器宏的东西?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36641813/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com