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

Support other libs in runtime compiler API #3726

Closed
kitsonk opened this issue Jan 20, 2020 · 5 comments · Fixed by #3863
Closed

Support other libs in runtime compiler API #3726

kitsonk opened this issue Jan 20, 2020 · 5 comments · Fixed by #3863

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Jan 20, 2020

Currently the runtime API would support the compiler option of lib, but it would fail in most scenarios where if a lib is included that isn't inlined into the TypeScript compiler. For example lib: [ "esnext", "dom" ] would fail, because lib.dom.d.ts is not inlined into the compiler.

We should support attempting to externally fetch libs when requested by the runtime compiler APIs, so we don't have to bake these in, but end users would be able to compile against a different set of libs.

@Pandawan
Copy link

As I mentioned in #3799, you can use the triple slash directive to reference libraries in a specific file.

/// <reference lib="https://raw.githubusercontent.com/microsoft/TypeScript/master/lib/lib.dom.d.ts" />

But perhaps allowing for simply lib="dom" like regular typescript would be nice.

In addition, some kind of option in the Deno.compile/bundle functions would be good (so that you don't have to reference the lib in every file).

@kitsonk
Copy link
Contributor Author

kitsonk commented Jan 27, 2020

Yeah, I think this should be pretty straight forward, and would allow /// <reference lib="dom" /> to work as well. I was going to work on something else next, but given there is demand for it from folks, I will start working on this now.

@cretz
Copy link

cretz commented Jan 27, 2020

@kitsonk - Awesome! Ideally this work could also help #2633 where an embedder can programmatically determine which libs to include also.

kitsonk added a commit to kitsonk/deno that referenced this issue Feb 4, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 4, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 7, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 7, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 8, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 8, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 10, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 13, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 13, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 15, 2020
Fixes denoland#3726

This PR provides support for loading TypeScript libs that are not
bundled with Deno lazily.  It also provides the ability for Deno to
support the triple-slash lib reference.  There are a couple other minor
fixes and improvements as well.
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 18, 2020
Fixes denoland#3726

This PR provides support for referencing other lib files that are not
used by default in Deno via the compiler APIs.
@ry ry closed this as completed in #3863 Feb 19, 2020
ry pushed a commit that referenced this issue Feb 19, 2020
Fixes #3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
@cztomsik
Copy link

FYI /// <reference lib="dom" /> doesn't work, it has lots of conflicts with existing deno types.

@cj1128
Copy link

cj1128 commented Oct 22, 2020

Any updates?

I got a lot of ts errors when I used @deno-types to include type definitions for the ky libarry.

// @deno-types="https://deno.land/x/ky@v0.23.0/index.d.ts"
export { default as ky } from "https://deno.land/x/ky@v0.23.0/index.js

From the error message, it is the lib.dom.d.ts which causes conflicts with other definitions.

TS2300 [ERROR]: Duplicate identifier 'Event'.
declare class Event {
              ~~~~~
    at asset:///lib.deno.web.d.ts:21:15

    'Event' was also declared here.
    interface Event {
              ~~~~~
        at asset:///lib.dom.d.ts:5285:11    and here.
    declare var Event: {
                ~~~~~
        at asset:///lib.dom.d.ts:5353:13
...

caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 21, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 24, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 24, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 24, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 31, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 31, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 31, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Jan 31, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
caspervonb pushed a commit to caspervonb/deno_std that referenced this issue Feb 1, 2021
Fixes denoland/deno#3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
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

Successfully merging a pull request may close this issue.

5 participants