Comments (7)
@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.
@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.
@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.
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.
@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.
@pozhidaevak, Yes, commenting export *
before transpiling sounds good. I haven't tried it.
from ts2gas.
Published with ca542f2.
from ts2gas.
Related Issues (20)
- Variable names changed when using import HOT 6
- transformer `removeExportEsModule`is overdoing it HOT 2
- (Minor) some comments around ignored statements are lost through transpileModule HOT 2
- within arrow functions `this` must be substitute with `_this` HOT 1
- This is screwing up arguments with default values HOT 5
- require and import HOT 55
- Inheritance class becomes TypeError in load order. HOT 13
- Error in tsconfig.json when npm installed HOT 4
- Multi-line import statements creates invalid Apps Script HOT 3
- ts2gas fails with message `Debug Failure. Output generation failed` HOT 1
- Typescript 3.4 support HOT 1
- npm package should contains .d.ts files
- stricter `npmignore`
- Improper conversion of [...string] HOT 3
- Support transpilation for V8 runtime HOT 3
- noSubstitutionBeforeBuilder cannot correctly convert try-catch clauses containing asycn / await. HOT 6
- Requiring tslib in transpiled code HOT 2
- Latest `ts2gas` crashes `@google/clasp`
- function imports are strange HOT 3
- addDummyModuleNodes removes JSDoc fileoverview comment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts2gas.