Comments (6)
Ah; I see. ;)
I will try it. Hopefully I get it to work without the need to consult you again. :)
If I am successful I would be glad contributing back. As I said, I really appreciate the handbook. Therefore I imagine that it could help others as well.
from typescript-transformer-handbook.
heya! currently there are issues (either a bug, oversight, or deliberate thing by the TypeScript team) when compiling down to common js and applying custom transformers - basically the imports don't get "bound" in the binding step and thus their usage areas don't get renamed...
i got around this in Compiled by... hacks... I'm not sure if this is in the handbook TBH https://github.com/atlassian-labs/compiled-css-in-js/blob/master/packages/ts-transform/src/constants.tsx#L48
from typescript-transformer-handbook.
Hey. Thank you for the immediate answer. Do I understand it correctly that the provided link is already the solution to the described problem? If this is the case I definitely have to try it. I am curious if it will work.
And btw why do you know such stuff? Unbelievable. :)
Am I wrong or is there really not much documentation out there? Anyhow; great work. I really appreciate the support.
from typescript-transformer-handbook.
It's a work around not really a solution 😅 - I found this by trial and error. There really isn't much information about this which is why I made the handbook in the first place.
If you get this working want to contribute back and mention this workaround in the handbook?
from typescript-transformer-handbook.
Sorry but I have to clarify the solution again. I think I understand the code snippet. But I do not understand in which "context" they are applying it.
- The whole "mechanism" starts when the target is CommonJS
- If this is the case they just add the "binding"
- If not ... the "binding" does not have to be added
Is this right? So in short: They are doing what I had in mind: it is necessary to add the "binding" manually, right?
Just some questions if I got it correctly:
- So for my example
ttransformer_1
would have to be added manually, right? - The added import declaration is correct, right? It does not have to be touched?
- In my case just the line
if (!Ttransformer.isInTransformContext()) {
would have to be updated, right?
This is the part from the transformer:
ts.createPropertyAccess(ts.createIdentifier("Ttransformer"), ts.createIdentifier("isInTransformContext")),
Here I would have to add the ttransformer_1
additionally, right?
So I would guess something like this:
ts.createPropertyAccess(
ts.createPropertyAccess(
ts.createIdentifier("ttransformer_1"),
ts.createIdentifier("Ttransformer")
),
ts.createIdentifier("isInTransformContext")
),
I just wanted to clarify and check if I understood it correctly. In the best case you just have to give me a thumb up. Thanks. ;)
from typescript-transformer-handbook.
I've gotten this reply from the TS team as to how we could work around the problem microsoft/TypeScript#38077
from typescript-transformer-handbook.
Related Issues (20)
- To align remove-node example with README.md
- Usage question: Adding a child node HOT 2
- Usage question: Modifying Nodes & Symbols HOT 1
- Usage question: Changing type checking of operators HOT 4
- Usage question: Modify class prototype HOT 1
- Binder Link on README.md is not working! HOT 1
- Found this article about working with comments
- Improvements HOT 17
- Usage question: Following imports
- General question with focus on bindings HOT 2
- Question: Replacing a call expression with multiple nodes
- How can I share a custom argument from a user's `tsconfig.json` to my custom plugin? HOT 1
- ts.create... is deprecated, now is recommanded to use ts.factory.create...
- Can I determine if a class extends a class that extends class X HOT 1
- TypeScript 5.0 unfortunately breaks most examples HOT 2
- Question: Can I use built-in typescript transformers?
- TRANSLATIONS WANTED
- Question: Advanced - Following module imports HOT 5
- Question ts-creator HOT 3
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 typescript-transformer-handbook.