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

import from tslib support in deno standard library #5427

Closed
southpolesteve opened this issue May 15, 2020 · 6 comments
Closed

import from tslib support in deno standard library #5427

southpolesteve opened this issue May 15, 2020 · 6 comments
Labels
feat new feature (which has been agreed to/accepted)

Comments

@southpolesteve
Copy link

I have a few modules that look like they should work with deno, except that they import from tslib. It looks like this was addressed in a PR, but never merged #227. Would the core team be open to reconsidering a similar PR to what was closed?

@aadamsx
Copy link

aadamsx commented May 15, 2020

I’m going to be using Azure CosmosDB on my next project and this change is needed by the CosmosDB Dev team to get the relevant lib to incorporate Deno.

@kitsonk
Copy link
Contributor

kitsonk commented May 15, 2020

@southpolesteve that PR didn't do what you wanted that PR to do. It dealt with how internal Deno code would have worked and it wouldn't have been available for runtime code persay.

Though I can see the value in consuming already transpiled TypeScript files that import from tslib. A very logical feature request that just hasn't come up before. Do you have a simple example file of what your emit looks like for one of these files? We can certainly build tslib into the Deno binary and have them available for importing.

@kitsonk
Copy link
Contributor

kitsonk commented May 15, 2020

(as a temporary work around, I believe you could use --unstable and import maps to take the "tslib" import and remap it to somewhere else where tslib existed).

@southpolesteve
Copy link
Author

Makes sense. Here is a simple example that would import tslib if importHelpers was turned on:

Source:

const foo = {}
const { bar, ...bax} = foo

Emitted code:

"use strict";
import { __rest } from 'tslib'
const foo = {};
const { bar } = foo, bax = __rest(foo, ["bar"]);

@bartlomieju bartlomieju added the feat new feature (which has been agreed to/accepted) label May 15, 2020
@bartlomieju
Copy link
Member

@kitsonk is this issue something that you still want to support?

@kitsonk
Copy link
Contributor

kitsonk commented Oct 31, 2021

It is something that is fairly trivial to support with import maps, for those using already emitted TypeScript. Feels like something we should add to the manual of how to use an import map to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat new feature (which has been agreed to/accepted)
Projects
None yet
Development

No branches or pull requests

4 participants