Giter Site home page Giter Site logo

Comments (8)

evmar avatar evmar commented on May 17, 2024

This feature is quite weird. If you create an intermediate variable (let foo = 'foo';) you cannot index into A with it (like A[foo]) -- it only allows string literals. This makes me wonder whether we can just rewrite A['foo'] into A.foo. I guess the former may occur for field names that aren't valid identifiers...

from tsickle.

mprobst avatar mprobst commented on May 17, 2024

Does it output a quoted access, or a non quoted? If it compiles into non
quoted, it'd actually be fine.

Evan Martin [email protected] schrieb am Fr., 18. Mรคrz 2016, 09:23:

This feature is quite weird. If you create an intermediate variable (let
foo = 'foo';) you cannot index into A with it (like A[foo]) -- it only
allows string literals.

โ€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#23 (comment)

from tsickle.

evmar avatar evmar commented on May 17, 2024

It outputs quoted.

from tsickle.

evmar avatar evmar commented on May 17, 2024

Got a CL ready that checks this. I am pretty scared I'm accidentally warning on some other, legal thing, so I think I want to put this behind a temporary flag.

from tsickle.

evmar avatar evmar commented on May 17, 2024

Another antipattern I spotted in the same vein:

let data: {[key: string]: string} = {
  foo: "bar",
};

I think you need to quote foo to prevent it from being renamed.

from tsickle.

evmar avatar evmar commented on May 17, 2024

If you have an any, perhaps we should require to use quoted accessors?

from tsickle.

mprobst avatar mprobst commented on May 17, 2024

from tsickle.

rkirov avatar rkirov commented on May 17, 2024

Randomly stumbled on this bug, through our documentation. Current status is that this is handled by 'https://tsetse.info/property-renaming-safe'. In any case, we definitely don't want to add such checks into tsickle - tslint and/or tsetse is the right layer for checks.

from tsickle.

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.