Live data from Hacker News

I Was Wrong About TypeScript

triplet.fi

161–170 of 194 posts

Re: I Was Wrong About TypeScript

#162
post #96
post #92

Earlier quoted context omitted.

Tests are weak evidence of the validity of a piece of data at runtime. Types are proof. The stronger your type system, the more you can prove.

But doesn't Typescript compile to JS, thus there's actually no type-checking at runtime? Certainly type checking can prove that it's the right type, but in my experience knowing that it's the right type but the wrong data is useless, I care if it's the exact data it's supposed to be. How does type checking protect you (or someone else) from inadvertently mutating a value without changing it type and causing problems…

It's all eventually compiled down to machine code, which doesn't have what you or I would call type checking.

Re: I Was Wrong About TypeScript

#164
post #88

Earlier quoted context omitted.

If you use --outDir, wouldn't the .js files that import the transpiled .ts files need to point to outDir instead? This is the kind of stuff that makes the "incremental" adoption argument hard for me to swallow. If I can't rewrite a .js file to .ts without any further ripple effects within the project, then it's not truly incremental. I wrestled with this stuff last week and ultimately ended up going with flow since i…

Hey, I work on the TypeScript team. I hope you'll reconsider, and maybe you can fill me in on the issues you ran into. Your .js files should typically be relative to each other, so unless you're using absolute paths (which you usually shouldn't!), this hasn't been a problem for other users. Is there something that I'm missing?

Hey Dan, thanks for responding. I think the key point you may be missing (or perhaps I missed a flag somewhere) is that I want relative requires but I don't want the intermediate js and sourcemap files cluttering up my project (and assuming I have an existing babel/webpack stack I'm happy with -- I just want the type checking).

I want the ability to convert any existing js file within the project to ts without having to touch a single other source file. I also want the type checker to assume that if I don't have a type definition for a package, that I don't want the use of that package to be type checked (without being forced to rewrite my ES6 imports to commonjs).

I was able to do this with flow but not typescript.

Is there something I'm missing?

Re: I Was Wrong About TypeScript

#165
post #64

Earlier quoted context omitted.

I can't go with that. Anders H is one of the most avuncular, helpful and accessible voices out there. Oh and his very verbs twinkle!

Well, I just saw a talk about TypeScript 2 and it felt to me that he was belittling JavaScript.

You're not your programming language. When people are expressing distaste about a language, it's (usually) not an attack towards its users.

Re: I Was Wrong About TypeScript

#166
post #62
post #51

Anyone have feedback on using Flow vs TypeScript?

I'm also interested in this question. Here's two things I saw on Jeff Morrison's (Flow author) Twitter: * http://djcordhose.github.io/flow-vs-typescript/2016_hhjs.htm... * https://gist.github.com/jeffmo/ef9214ca3acfe76c54a237b5710d3...

Interesting last line in that presentation:

"Flow written in OCaml, Typescript in Typescript"

Re: I Was Wrong About TypeScript

#167
post #165
post #64

Earlier quoted context omitted.

Well, I just saw a talk about TypeScript 2 and it felt to me that he was belittling JavaScript.

You're not your programming language. When people are expressing distaste about a language, it's (usually) not an attack towards its users.

Yes, but talking about "toy languages" when literally millions of people on the world make a living out of this is just mean :(

Re: I Was Wrong About TypeScript

#168
post #64

Earlier quoted context omitted.

Well, I just saw a talk about TypeScript 2 and it felt to me that he was belittling JavaScript.

You may be traumatised if you ever hear Crockford talk about JavaScript!

Haha, I met him on a JS conf once. There was one of those old "JavaScript has no types and is no real language" guys and he kicked his ass.

Basically he said static typing could be good and there were languages like Scala out there with real good type systems, but most of the "pro static types"-fanboys are using crap like Java or C++.

Re: I Was Wrong About TypeScript

#169
post #64

Earlier quoted context omitted.

Well, I just saw a talk about TypeScript 2 and it felt to me that he was belittling JavaScript.

If you've ever worked with a strongly typed language you can't but belittle JavaScript ;)

I worked with C++, Java and Scala, and all felt really unwieldy.

Re: I Was Wrong About TypeScript

#170
post #85

Earlier quoted context omitted.

Ah, yes, that's what I'm doing most of the time. But like you said it's no better than using JS directly, haha.

Actually, it's better. If the core of your application has non trivial business logic, it's a good idea to write it in typed way and write ui and other support stuff with partially typed code.

Fair enough and I think with strict null type checking, where null/undefined isn't part of any anymore things would still get much better than with plain JS.
Post reply on HN