Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

範例 compile 失敗 #185

Open
xuan0123 opened this issue Jul 19, 2020 · 0 comments
Open

範例 compile 失敗 #185

xuan0123 opened this issue Jul 19, 2020 · 0 comments

Comments

@xuan0123
Copy link

在範例 examples/declaration-files 的第三個範例 03-jquery-d-ts 中,在 tsconfig.json 內的 files option 無法讓 TypeScript compiler 知道全域的 jQuery 方法的宣告。

// tsconfig.json

{
  "files": ["src/index.ts", "src/jQuery.d.ts"]
}

錯誤訊息:

index.ts:1:1 - error TS2304: Cannot find name 'jQuery'.

1 jQuery('#foo');
  ~~~~~~


Found 1 error.

一定要在 index.ts 中給三斜線 reference path。

// src/index.ts

/// <reference path="./jQuery.d.ts" />

jQuery('#foo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant