Tôi đang thiết lập loại bản ghi trong Visual Studio 2015. Tôi sẽ sử dụng jquery với tệp TS. Khi tôi sử dụng jquery, VS sẽ gạch chân '$' và nói không thể tìm thấy tên, và sẽ không xây dựng thành công. Cách duy nhất nó sẽ xây dựng là nếu tôi thêm tham chiếu đến jquery typings trong mỗi tập tin TS. /// <reference path="typings/index.d.ts" />
Có cách nào để sử dụng tham chiếu này trên toàn cầu thay vì thêm nó vào mọi tệp không?
Trong Visual Studio Code Tôi không có vấn đề này.
thư mục My trông như thế này -Scripts --ts --- typings --- main.ts tsconfig.json --js
tập tin tasks.json My trong thư mục gốc
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// Tell the tsc compiler to use the tsconfig.json from the open folder.
"args": ["-p", "../Scripts/Weblink/ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
taskconfig.json trong Scripts/ts
{
"compileOnSave": true,
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"outDir": "../lib/"
},
"exclude": [
"typings/*"
]
}
phiên bản nguyên cảo bạn đang sử dụng? – lenny
Phiên bản mới nhất 2.1.4 – stanggt3
Được cài đặt với tệp VS từ bản ghi, chứ không phải Node – stanggt3