Code Monkey home page Code Monkey logo

Comments (7)

pozhidaevak avatar pozhidaevak commented on August 26, 2024

@grant , can you please explain why __export() should be also commented?
In my case __export() apears only after translation. Are there cases there it can be used before translation?
I added commenting of only export ... from ... and it works fine

v--TS--v
export * from 'file'
–––
var exports = exports || {};
var module = module || { exports: exports };
// export * from 'file'
 ^--GS--^

from ts2gas.

grant avatar grant commented on August 26, 2024

@pozhidaevak I'm really not sure what the case would be. __export is not valid in Apps Script of course.

Can you provide example expected INPUT and OUTPUT code?

from ts2gas.

pozhidaevak avatar pozhidaevak commented on August 26, 2024

@grant It is kind of follow up of this issue
On that issue, you suggested to comment __export but __export is actually in the OUTPUT when export is in INPUT. So I don't see why __export should be commented... I think there is no use case for __export be in the input. But I'm new to js so I may be wrong...
Both input and output are presented in original issue

from ts2gas.

grant avatar grant commented on August 26, 2024

So ts2gas work like:

  • Take ts
  • Transpile to gs
  • Add this line to fix export errors:
var exports = exports || {};
var module = module || { exports: exports };

I think we may need to additionally test that export * transpiling works.

  • Add some tests
  • Add any necessary transforms.

from ts2gas.

pozhidaevak avatar pozhidaevak commented on August 26, 2024

@grant , I thought you were ok with me just commenting out export * in input for ts2gas.
Here is how it looks:

v--TS--v
export * from 'file'
–––
var exports = exports || {};
var module = module || { exports: exports };
function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}

__export(require("file"));
 ^--GS--^

the result is not valid due to require()

so I want to make it look like

v--TS--v
export * from 'file'
–––
var exports = exports || {};
var module = module || { exports: exports };
// export * from 'file'
 ^--GS--^

from ts2gas.

grant avatar grant commented on August 26, 2024

@pozhidaevak, Yes, commenting export * before transpiling sounds good. I haven't tried it.

from ts2gas.

grant avatar grant commented on August 26, 2024

Published with ca542f2.

from ts2gas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.