1

Which syntax is "correct" TypeScript syntax ?. I prefer the first one. But what's about guidelines ?

Note for UpperCase variables: yes I know. We use that syntax to differentiate public and private variables. (Yes I know that doesn’t exist in JavaScript)

Comments
  • 5
    That uppercase shit drives me nuts.
    Inside a class the privateness is completely irrelevant and outside it you shouldn't see private members or your IDE sucks ass.

    The only difference seems to be the semicolon? Even though your compiler is going to insert them - always use semicolons. Like.. machine guns are very well build with that hammer-like trigger, yanked down onto the bullet for fucken ages. We always used semicolons in most actually used languages and we should keep doing so. But to be more specific - ASI can fail and you don't want to debug that shit.

    Imo you should always use brackets around the args of an arrow function. Makes it easier to add parameters and is way nicer to read.

    And just outta interest: does anyone being in the business for more than 10 years actually use font ligatures?
  • 2
    @nitwhiz Yes I agree for UpperCases, but it is too late to move back on it.
    It’s used during PR (You changed HTML data bind and it’s a lowercase: You are binding to a variable you are not supposed to)
    Thanks, I agree on semicolons, I like to explicitly use them
    For last question : I have about 15 years dev experience and discovered this font only recently and loving it !

    edit (In case someone is interested, it's a knockoutjs app)
  • 2
    ES2019 bring's private fields to JavaScript (and doesn't TypeScript already support that?)

    Sure, you'll transpile it for all these fucker browsers, but in theory...

    https://sitepoint.com/javascript-pr...
  • 1
    @Wack It is in TypeScript. I was just wondering if guideline is to add them or not. I see TypeScript as “Use next version JavaScript function today and be typesafe). Like this code. There is no explicit type definitions, but everything is strong typed.
  • 2
    Just find a style you and your coworkers like and stick to it. Still, PascalCase feels definitely weird for something that's not a name of a class or a module.
  • 3
    I wouldn't mix the use of semicolons. Either use them everywhere, or nowhere.

    @nitwhiz Totally agree on the brackets for arrow functions. And although I haven't been in the branch for that long, no, I wouldn't ever use ligature fonts like that.

    Edit: fuck that uppercase shit
  • 0
    Edit: uploaded wrong screenshot

    Either use them always, or don't use them. I prefer using them, but that's mostly my background.

    The paradigm shifting is kind of bugging me though. Given an observable, my instinct would be to build an integrated series so it would update without imperative prompting or modulation (I'm assuming this is probably react, if it's angular, I have other hot sports opinions regarding the usages):
  • 0
Add Comment