Comments (1)
Hi there,
It's worth noting that it seems to be how TypeScript compiler resolves types.
Yes, as far as we have a duck typing TypeScript compiler will match types in later stages, but it won't assign a name Model
(in your case) automatically since you didn't specify it anywhere. You can test it by doing some interesting trick: just move cursor to the first param1
in param1: param1
in return statement object and press "navigate to the symbol" (f12 in vscode) - it won't go anywhere.
If there's such option with linter or compiler that'd be nice.
I think it's possible to write such eslint rule for sure, but most probably it will require a type checking information. Also, I think this case is suitable for #10, but the transformer can't generate errors/warnings properly at the moment I'm afraid.
For my experience of maintaining lightweight-charts (we use this transformer there for a long time) I can tell that if you have any kind of test (manual or automated ones) it's much much easier to maintain the project to have it work with this transformer once you setup it and check everything known at the moment of introducing.
It feels like transformer plugin has to do the work compiler chose not to.
Oh no, I don't think that this transformer should do this work in any way 🙂 I mean, Microsoft has the whole team to support compiler and type checking especially, I don't think that part of compiler's work should be done somewhere outside, just because it will be outdated on every new version of the compiler. Just look at any of JetBrains IDE with their own TypeScript implementation - they have to do a lot of work every new TypeScript release just because they don't use TypeScript's compiler and they still have a lot of unimplemented features so for (for instance they don't have support for composite projects what makes work on big project painful).
This is might be huge amount of work actually, I think it's much easier to implement eslint rule to enforce people to write types for everything 😂 (probably tslint/eslint already have such rule but I don't remember exactly).
We have had exactly the same issue when we introduced this transformer in lightweight-charts some time ago and fixed it by adding a generic specifier, e.g. tradingview/lightweight-charts@080aa9a#diff-8bbee54ab053b73e1b695d299bc1f31998a043bd96da02dc2d4020e9169e2d97R153 - for me it's the best solution of this issue.
from ts-transformer-properties-rename.
Related Issues (20)
- Add errors/warning where we're sure that an error could be HOT 7
- Enums are not renamed causing runtime error
- Constructor parameters in internal classes get prefixed. HOT 2
- Add loose mode
- Mapped types do not respect @public jsdoc HOT 4
- Incorrect handling mapped types
- [feature] Lazily resolve TS Program HOT 9
- Error: Cannot find source file HOT 5
- Wrong code for indexed generic in returned type
- Incorrect handling unknown/any casting
- Return type of public function is marked as internal HOT 1
- An object with quoted keys is not minified
- Properly handle class members with decorators HOT 2
- Fields declared with `declare` keyword are renamed but shouldn't
- Improvde DX and migration from `ts-transformer-minify-privates`
- Incorrect handing `in` operator with string literal
- Handle Internal Class renames HOT 7
- Getters/Setters with Object.defineProperty HOT 7
- Computed or Invalid property names HOT 14
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 ts-transformer-properties-rename.