Code Monkey home page Code Monkey logo

Comments (1)

timocov avatar timocov commented on June 1, 2024

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)

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.