简体   繁体   English

在没有 tsconfig.json 全局项目级别的情况下,打字稿文件在 vs2017 中自动创建 Javascript

[英]Typescript file auto create Javascript in vs2017 without tsconfig.json globally project level

I am working on typescript project.we have to generate the javascript file automatically by saving the ts file without any tsconfig.json.我正在打字稿项目。我们必须通过保存没有任何 tsconfig.json 的 ts 文件来自动生成 javascript 文件。

exmaple test.ts file here示例 test.ts文件在这里

interface Person {
    firstName: string;
    lastName: string;
}

function greeter(person: Person) {
    return "Hello, " + person.firstName + " " + person.lastName;
}

let user = { firstName: "Jane", lastName: "User" };

document.body.textContent = greeter(user);

we can use tsconfig.json to generate the javascript file, it is working fine.我们可以使用 tsconfig.json 来生成 javascript 文件,它工作正常。 it is creating the javascript files for associated .ts file.它正在为关联的 .ts 文件创建 javascript 文件。

but without using any .json setup, can we generate the .js file automatically by saving .ts file in vs2017.但是不使用任何 .json 设置,我们可以通过在 vs2017 中保存 .ts 文件来自动生成 .js 文件吗?

what are all the settings we have to configure to make it done in vs2017.我们必须配置哪些设置才能在 vs2017 中完成。

If you are not using a tsconfig.json file, then the project property pages should would be the place to set CompileOnSave.如果您没有使用 tsconfig.json 文件,那么项目属性页应该是设置 CompileOnSave 的地方。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeScript tsconfig.json文件中使用typeRoots与baseUrl的相对路径 - relative path using typeRoots vs. baseUrl in TypeScript tsconfig.json file TypeScript编译器忽略tsconfig.json中的声明文件 - TypeScript compiler ignores declaration file in tsconfig.json 为什么 Vite 会创建两个 TypeScript 配置文件:tsconfig.json 和 tsconfig.node.json? - Why does Vite create two TypeScript config files: tsconfig.json and tsconfig.node.json? tsconfig.json中文件夹中的相对文件路径 - Relative file path in folders in tsconfig.json 如何在 tsconfig.json 设置之外编译根 level.ts 文件? - How to compile a root level .ts file outside of the tsconfig.json settings? 为什么打字稿编译器会在服务器启动时更改我的 tsconfig.json 文件? - Why is typescript compiler changing my tsconfig.json file on server start up? VS2017 Javascript智能感知 - VS2017 Javascript Intellisense 将tsconfig.json放置在Symfony Encore中以定义TypeScript配置? - Where to place tsconfig.json in Symfony Encore to define TypeScript config? Angular 中 tsconfig.json 文件中的 lib 数组中的 dom 是什么? - What is dom for in the lib array in the tsconfig.json file in Angular? Typescript 编译器在 tsconfig.json 上包含文件时找不到绝对路径 - Typescript compiler not finding absolute paths when including files on tsconfig.json
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM