Live data from Hacker News

TypeScript at Google

neugierig.org

111–120 of 201 posts

Re: TypeScript at Google

#111
post #80

Google has enough resources for someone to write a transpiler that can take annotated JS and convert most of it to TypeScript. It's certainly much more pleasant than having to type random comments everywhere, which kinda makes syntax highlighting way less useful. Oh, and last I checked there were no editor plugins for linting Closure Compiler annotated code. Another option would be to add TypeScript support to Closur…

> I'd love to see Facebook, Google, and Microsoft team up in this space, instead of creating 3 separate but very highly similar tools. It'll probably happen anyway, but the current competition will determine which tool that will be. So far TS looks like it's winning it, but, clearly, not by a large enough margin that the industry coalesces around it - yet.

TS included Flow features over the years (control flow based typing, strict null checks, etc.)

Re: TypeScript at Google

#112
post #41
post #22

Earlier quoted context omitted.

I don't know what you find complex about the type system, but I actually find it slightly limiting. They keep improving it, so it can express about 95% of what I want, but I still hit situations where I can't tell the compiler everything.

What sorts of things do you have trouble expressing with the type system?

I can't think of something off the top of my head, but it's usually related to generics. I'll type something that makes sense, but the compiler doesn't like it.

Another issue is that handling of string literals as types can be wonky when they're being compared against the type "string", which they should always satisfy but sometimes don't.

Re: TypeScript at Google

#113

Earlier quoted context omitted.

So I know you also use React extensively at twitch, so how are you finding react and typescript working together? I've been using the two together recently and its been great. Like you I don't think I could ever go back to not using typescript for anything but the smallest projects. However, often times I've found some common react patterns to be difficult to express in typescript. Namely default props and high order…

For the default props side of things, as of typescript 3 and the latest @types/react it should work as you would expect: https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in...

I saw that for default props, but can I use it yet?

The React typescript definitions are still on 2.8 [1], and I imagine that they plan to stick with 2.8 until maybe the next major react release? I have no idea where people discuss things like react types for DefinitelyTyped. Github issues seem like a mess due to the sheer number of different projects sitting in a single repo.

[1] https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1d96...

Re: TypeScript at Google

#114

Earlier quoted context omitted.

I hope the work they did with the Babel team with help with this. https://blogs.msdn.microsoft.com/typescript/2018/08/27/types...

I'm really eager to see availability of some extra features via this new pathway. But I am less excited about projects containing TypeScript plus the large number of transitive dependencies from a typical Babel set up; I've been greatly enjoying TypeScript instead of that.

I am looking forward to see some production ready versions of RY latest project Deno "A secure TypeScript runtime on V8"

https://github.com/denoland/deno

Re: TypeScript at Google

#115

Earlier quoted context omitted.

TypeScript was released in 2012, I wouldn't call a 4 year old tool an early release. And if you were already using Webpack picking it up was as easy as adding a loader. IMO, using such early proposals isn't worth the risk in production. Especially for proposals that are so young that they haven't even settled on a clear spec as to its behavior, like the pipeline operator.

> TypeScript was released in 2012, I wouldn't call a 4 year old tool an early release. Goddamn time travelers, stop messing with chronology!

4-year old by the time GGP found it "painful to use as any early release", which was 2 years ago.

Re: TypeScript at Google

#116
post #7

We’re going through a similar process at my company - how do we refactor the decade old startup-style JS without 1) spending a year rewriting everything from scratch generating little business value and potentially introducing regressions in the process 2) continuing to build stuff on that shaky house of cards. It looks like the solution we’ve kind of settled on has also been TypeScript. At this point it’s probably s…

In my experience old JS code suffers from lack of structure and discipline much more than type safety. Can you provide an example where that isn't the case in your codebase?

Re: TypeScript at Google

#117
post #78

Real big fan of TS, like anything though you just have to be disciplined when using it. Type absolutely everything and set the transpiler to the most aggressive checks possible... If you’re being lazy and putting : any everywhere and then complaining about how good it is...you’re doing it wrong In our project I’ve found we make a lot less mistakes than with pure JS and there’s a lot less pointless type check unit tes…

I always use it with > "compilerOptions": { "strict": true } But given the huge number of other options I worry that like GCC's '-Wall', that doesn't actually give you the strongest possible type checking. Anyone know about that? My aim with Typescript is to turn JS into OCaml.

So... ReasonML?

Re: TypeScript at Google

#118
post #104
post #68

I think the most fascinating thing here is that Google are turning to a language developed and maintained by Microsoft.

It's come to a time that discriminating MS was an old thing.

Or maybe it's about Microsoft's continued influence, especially in the Open Source community.

Re: TypeScript at Google

#119

I haven't used it in a while. Does it play nice with plain-JavaScript libraries from npm yet? I quit using it a few years back because it was a _nightmare_ having to write d.ts files for everything or be unable to use noImplictAny for your own files. `AllowJs` wasn't even a thing when I started using it, but even after its addition, this problem continued to be absolutely disastrous for my project. I remember being v…

I don't have any problems, just use require() for libraries that don't have TypeScript definitions. I wouldn't bother writing .d.ts files for the libraries you use, just be more careful using them.

Re: TypeScript at Google

#120
What js in browser is missing is something that golang provided on the server - fast, simple (and more standard) way of writing and executing code, including large code bases.

Typesafety is a small part of it and I’m not sure whether switching or choosing entire dev tooling based on just that is worth it. Just structure your code better and use react prop types and most of type issues go away, in react code bases.

Post reply on HN