-
Notifications
You must be signed in to change notification settings - Fork 55
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
add instructions on how to make deno lsp happy with deno deploy types #24
Comments
I found the following code type checks well with lsp and /// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.ns.d.ts" />
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.fetchevent.d.ts" />
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.window.d.ts" />
addEventListener("fetch", (e) => {
e.respondWith( new Response("Hello world"));
}); (Note: But I don't know if it's an ideal way to type Deploy scripts. |
The solution by @kt3k does not work for me in VSCode … but a slight variation does: Save deployctl types in your project: $ deployctl types > deploy.d.ts Reference these types: /// <reference path="./deploy.d.ts" />
addEventListener("fetch", (event: FetchEvent) => {
event.respondWith(new Response("Hello world"));
}); To check or run the code: $ deployctl check --libs="" main.ts
$ deployctl run --libs="" main.ts Also make sure the Deno extension (denoland.vscode-deno) is enabled for your workspace in VSCode so things like Edit: You may have to restart your editor for the changes to be picked up. |
I'm assuming these workarounds will become stale at some point with upgrades to deployctl or deno. Is this something that can be built-in? Maybe this is a question better suited to the VS Code Deno plugin. Ultimately does this come back to lib.dom.d.ts not being properly typed (e.g. - |
I wanted to provide a little more context on why these kinds of workarounds feel less than ideal: I did manage to deploy a simple JSX Hello World app via GitHub integration with the Deno Deploy Dashboard while using this workaround. Now I'm simply trying to develop that same working app locally such as:
The workaround mentioned here to help VS Code understand what I can start the app, but then as soon as I try to hit
All the conflicts are between I don't really need my IDE to know what a After doing that, I seem to be able to render "Hello World" again locally. I guess I mostly wanted to convey that these little workarounds to smaller issues can actually have cascading effects leading to more friction. I'm hoping there's a better way to address this down the road. |
@forgo After creating deployctl types and referencing them in your program, did you also run your program according to my instructions? Specify an empty lib list when you reference $ deployctl run --libs="" ./forgo.tsx |
I think denoland/deno#10999 will help with addressing this. |
Now that Deno
{
"compilerOptions": {
"types": [
"https://deno.land/x/deploy@0.3.0/types/deploy.ns.d.ts",
"https://deno.land/x/deploy@0.3.0/types/deploy.window.d.ts",
"https://deno.land/x/deploy@0.3.0/types/deploy.fetchevent.d.ts"
]
}
}
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false,
"deno.config": "./tsconfig.json"
} No more triple-slash directives needed in source files. |
Thanks for contributing by opening an issue. This project is being archived because you can now use If you have feedback about Deno Deploy, please open an issue on this repo: https://github.com/denoland/deploy_feedback |
cc @danopia
The text was updated successfully, but these errors were encountered: