TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Google Feedback on TypeScript 3.5

396 pointsby dknsover 5 years ago

16 comments

heavenlyhashover 5 years ago
&gt; (I might suggest the underlying problem in this code is relying on inference too much, but the threshold for &quot;too much&quot; is difficult to communicate to users.)<p>This is a <i>very</i> outstandingly interesting line out the whole writeup.<p>I like the writeup in its entirety for being very balanced and thoughtful, but this line in particular really stands out to me as worth more thought for anyone interested in language and type system design.<p>Inference is great.<p>Except... when it&#x27;s not. When it&#x27;s &quot;too much&quot;. When it starts making breaking changes appear &quot;too distantly&quot;.<p>It&#x27;s an interesting topic to reflect upon, because the inference isn&#x27;t <i>making</i> a breakage; just shifting around where the breakage <i>appears</i>. (And this makes it hard to ever direct criticism at an inference mechanism!) But this kind of shifting-around of the breakage appearance can be a drastic impact on the ergonomics of handling it: how early it&#x27;s detected, how close to the important change site tooling will be able to point the coder, etc. That&#x27;s important. And almost everything about it involves the word &quot;too&quot; -- which means the area is incredibly subjective, and requires some kind of norm-building... while not necessarily providing any clear place for that norm-building to center around.<p>I don&#x27;t have a point here other than to say this is interesting to reflect on. I suspect the last chapter on type inference systems has not yet been written. Can an inference system be designed such that it naturally restrains &quot;too&quot; much use of it?
评论 #20919670 未加载
评论 #20917514 未加载
评论 #20917658 未加载
评论 #20917868 未加载
评论 #20917010 未加载
评论 #20917133 未加载
评论 #20917158 未加载
评论 #20917689 未加载
评论 #20923614 未加载
评论 #20917126 未加载
评论 #20917262 未加载
评论 #20923311 未加载
burtonatorover 5 years ago
Typescript is absolutely amazing. I&#x27;ve been working with it for the last 8 months.<p><a href="https:&#x2F;&#x2F;getpolarized.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;getpolarized.io&#x2F;</a><p>and the source is here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;burtonator&#x2F;polar-bookshelf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;burtonator&#x2F;polar-bookshelf</a><p>I could have NOT made as much progress just by using JS directly. When you have a large code-base and you&#x27;re trying to make progress as fast as possible refactoring is needed and the strict typing is invaluable.<p>Honestly, the MAIN issue with TS are issues around webpack + typings for 3rd party and older modules.<p>I&#x27;d say 85% of the code I want to use already has types but when they don&#x27;t it&#x27;s frustrating to have to pause and write my own types.<p>I have 20 years of Java experience. Used it since 1.0 and for the most part have been unhappy with everything else.<p>I&#x27;ve decided that Node + Typescript is by far the most productive environment for me to switch to. I can code elegant apps with both front and backends and I get strict typing.<p>Could NOT have made so much progress without TS.
评论 #20920130 未加载
评论 #20921707 未加载
Stay_frostJebelover 5 years ago
This write-up led me to Evan Martins blog. What a gold mine. Digestible writing with a peek inside of Google&#x27;s internals. <a href="http:&#x2F;&#x2F;neugierig.org&#x2F;software&#x2F;blog&#x2F;" rel="nofollow">http:&#x2F;&#x2F;neugierig.org&#x2F;software&#x2F;blog&#x2F;</a>
jannesover 5 years ago
I love TypeScript. I started using it around v1.0. Microsoft has hit some gold with it.<p>When I first started using it I had lots of `any` in my code (like the Google employee is describing here). But over time it really starts being extremely clean.
评论 #20916940 未加载
vallodeover 5 years ago
Issues like these are the reason we can thrive as a community. Not playing a blame-game and offering direct feedback to a wonderful open source project. Trying to get my own company to get more involved in feedback to the open source tools we use as I think it is so extremely respectful and encouraging!
bsaulover 5 years ago
A little off-topic:<p>I&#x27;m currently trying to find a way to write (type safe) business logic once, then reuse it pretty much everywhere (mobile &#x2F; web &#x2F; desktop),and it seems to me that typescript has become the only option. Javascript runtime is present everywhere, and can interface with anything.<p>Does someone knows of another alternative (viable right now, or in the coming months) ? I know llvm can theoretically target any platform, including wasm, but how painfull is it in practice ? Can you write a line of code that does a network request then expect it to run as it is on the browser and on mobile platforms ?
评论 #20917487 未加载
评论 #20917142 未加载
评论 #20917374 未加载
评论 #20919407 未加载
评论 #20917180 未加载
评论 #20917474 未加载
评论 #20917241 未加载
评论 #20920004 未加载
juliendcover 5 years ago
I&#x27;ve recently built a Node server with TypeScript and it&#x27;s a joy to use with external libraries when the types are available. It&#x27;s such a time saver to not have to guess which method to call with which arguments (I&#x27;ve had only experience with dynamic languages before). Some libraries don&#x27;t have types or they are outdated but it was a minority.<p>With the experience I&#x27;ve found that most of the type errors are actually between the backend and the frontend in web applications. It&#x27;s still hard to fully type the entire flow from the database calls with the ORM to the objects manipulation in the frontend.<p>How are you dealing with that? We used Nexus with GraphQL but it was still a bit cumbersome.
评论 #20923099 未加载
评论 #20922380 未加载
lxeover 5 years ago
Almost every single Flow version upgrade is like this — every new version brings a slew of errors due to Flow’s continuous movement away from practicality towards “soundness”.
评论 #20920078 未加载
评论 #20918829 未加载
评论 #20919634 未加载
评论 #20919399 未加载
dmixover 5 years ago
&gt; but any time someone saves a Selection into a member variable, they ended up writing down whatever type TS inferred at that time, e.g.<p>&gt; mySel: d3.Selection&lt;HTMLElement, {}, null, undefined&gt;;<p>I&#x27;m curious how Google and others approach adopting Typescript gradually, as I&#x27;m pretty new to it, I&#x27;m assuming it goes like: The programmer converts code to Typescript and when they come across return types they copy the inferred type and add it to the codebase directly wherever possible. I&#x27;m assuming just as a matter of using (untyped) libraries you need to rely on the output of Typescript in order to try have every return typed.<p>So the biggest problem seems to be how TS infers things changed meaning you can&#x27;t always trust what you copied as staying consistent, even if the source library doesn&#x27;t change itself. That&#x27;s always something to keep in mind for overhead.
评论 #20921025 未加载
andreigasparover 5 years ago
So happy to see the attention Typescript is getting lately. Absolutely love the language, and have been using it since it got released.
评论 #20921757 未加载
tannhaeuserover 5 years ago
Is there a way to migrate jsdoc-annotated JavaScript code over to TS, and is TS&#x27;s minifier as good as Google&#x27;s closure-compiler yet?
评论 #20916875 未加载
评论 #20916754 未加载
评论 #20917286 未加载
评论 #20917820 未加载
msoadover 5 years ago
filter(Boolean) is a bad idea anyways. I was bitten by this before.
评论 #20920280 未加载
_the_inflatorover 5 years ago
It is very funny to read this from Google, since we talked about similar problems with Google regarding Angular upgrades, where features were modified that Google considered not used&#x2F;no use cases known, while we were relying on these.<p>From my point of view Core members of any super large project (like React, Angular, TypeScript) are limited by design in what they perceive as their target audience and their use cases. This is simply a matter of fact: even as a core dev you cannot know how every dev uses your product.<p>So this is some sort of left-pad moment for TypeScript.
psv1over 5 years ago
Not a TypeScript user, but what really stood out to me is that Google are using a monorepo.
评论 #20916987 未加载
评论 #20918817 未加载
评论 #20916955 未加载
评论 #20919297 未加载
评论 #20917409 未加载
评论 #20916946 未加载
brlewisover 5 years ago
I&#x27;m really curious how many lines of TypeScript are in use at Google. I bet most JS is still Closure.
评论 #20917748 未加载
jbverschoorover 5 years ago
Google sure has a lot of comments these days