Replies: 18 comments 20 replies
-
TypeScript is just JavaScript with types, why would you skip type checking? That completely defeats the purpose of using TypeScript. If it is to save time in development just use |
Beta Was this translation helpful? Give feedback.
-
i believe having --no-check on by default is implicit behavior which is too dangerous to excuse, sure, it can be exponentially faster to not run tsc, but type checking is the most important part of typescript, you remove that and now you have javascript with meaningless types. I think --no-check is fine as it is and having it on by default would also be a pretty big suddent change which would be unexpected to a lot of people. |
Beta Was this translation helpful? Give feedback.
-
An argument for skipping type-checking is that, usually, this is already done by an editor plugin while working on the code so, most of the time, you won't hit any type-errors when executing |
Beta Was this translation helpful? Give feedback.
-
@MarkTiedemann The final production code needs to go through the official TypeScript compiler for quality assurance. |
Beta Was this translation helpful? Give feedback.
-
This issue is carried over from the large amount of discussion about it in #5436, ref #5436 (comment).
-1. There's nothing wrong with Deno having some unassertive considerations based on what editors do, but a language's type system not being enforced by default is a big deal. I disagree with basing such a crucial CLI design decision on editor functionality. But even accepting that, if we're taking the perspective of an integrated workflow, why is adding |
Beta Was this translation helpful? Give feedback.
-
I should have provided a bit more context. First, to make it abundantly clear, this is open for discussion, and would be for Deno 2.0 at the earliest. Second, the biggest argument for it in my mind is that Deno is supposed to be fun and productive, and things that get in the way of casual, experimental use of JavaScript or TypeScript make it harder for people to get started and be productive and have fun. This suggestion wasn't even one that occurred to me until one of the core TypeScript team members said do me "why does Deno even type check by default" which made me think, and is something @ry has also started thinking about. This doesn't mean that type checking would go away, it just means that it is opt in, which potentially could make it a heck of a lot easier for people to get on board. Especially since we are strict by default in our type checking, which I think is something we wouldn't ever want to change now, does put a big roadblock in front of people experimenting with Deno. I have even found myself sometimes writing stuff in JavaScript just to avoid getting bogged down with making sure a quick experiment is 100% valid TypeScript. I personally want to see more people adopt TypeScript, which means that we need to continue to try to find ways to make it fun and productive when using with Deno. Another consideration for 2.0 is making TypeScript diagnostics non-terminal. In that case, you would potentially get a load of errors, but barring a syntactic error, Deno would try to run your code. |
Beta Was this translation helpful? Give feedback.
-
to me this argument doesnt hold because coincidentally one of the biggest things that can prevent people from having fun is random bugs because their types dont check out. Moreover, this is even worse for the argument of a beginner, because a beginner is unlikely to know that deno just doesnt run type checking by default. This is why setting this default is incredibly dangerous. Even so, the argument of "its easy to just add |
Beta Was this translation helpful? Give feedback.
-
I think of TypeScript as JavaScript with fancy comments (types). The runtime, which is a JS runtime, doesn't use the fancy comments. Therefore breaking execution by default, if a fancy comment is incorrect, seems illogical to me. The answer is not as simple as "just use Currently, Deno assumes people don't know what they're doing and doesn't execute if the fancy comments are incorrect, although the JS itself may be correct. People who know what they're doing need to specify the additional I don't think this assumption is reasonable. IMO, Deno should assume people know what they're doing and require people who aren't sure what they're executing to specify a Two reasons come to mind:
Most people use an IDE with integrated TS type checking. So, by the time they run the code, they want to run it, no matter if the fancy comments are correct or not. Of those people that don't use an IDE, most people are probably experienced, meaning one can assume they know what they're doing.
When writing a module, if any upstream module contains incorrect fancy comments, then execution of the module breaks. Sure, the maintainer should have checked the types before publishing their module. But now any downstream consumers are negatively affected by the maintainer's choice to use TS instead of JS. Consider someone that doesn't care about TS, may even not know TS, writing a Consider someone writing a module that imports a module that imports a module with incorrect fancy comments. Should they need to deal with the |
Beta Was this translation helpful? Give feedback.
-
This will make "type" become "mark". As a user, I am happy to accept this change, because I hate TS always complains to me about type errors, and I just want to run it. But I still don’t think this is a good idea, you know, the "default behavior" will always be accepted by more people, which will cause the types in the Deno project to be less reliable. Importing a module that has not been type-checked into a project will be more likely than ever before. Please note that the wrong type is definitely more harmful than "any". |
Beta Was this translation helpful? Give feedback.
-
I agree with @kitsonk here; I want Deno to be fun, productive and quick. From that angle, A point that I haven't seen brought up either is that it mirrors the behavior of Bottom line, I like it, I think we should do it. |
Beta Was this translation helpful? Give feedback.
-
As the begginer, i absolutely agree with @kitsonk the proposed changes to make --no-check as default deno cofiguration. I think typescript are needed for some of critical method, function or variable that need more attention, thus not all javascript code should need type check safe. As long as we can ensure that it would be no intruder come on our code, and we have checked the code for any possible mistake upfront, i think it is safe and fine. Typescript in my eyes makes my codes hard to see and make my eye tired and struggle just to find what wrongs with typescript code instead of just focus on the concept to create solution using javascript code. Javascript is simply flexible and easy to understand but at some point we have to take more attention with the code for any possible mistake. This is our task to scrutinize upfront before going into live. |
Beta Was this translation helpful? Give feedback.
-
since some people don't want to discuss in the issue, here's a summary of my viewpoint:
on common arguments for no typechecking being the default behavior:
on misc. other statements:
|
Beta Was this translation helpful? Give feedback.
-
I wouldn't worry about a hypothetical proposal that might never materialize. |
Beta Was this translation helpful? Give feedback.
-
I hope type checking will remain on by default. Many previous commenters have made good arguments for this that I won't repeat. For people who are choosing between Node and Deno, type checking by default is a reason to choose Deno. Once command line switches or config files are required to get type checking, why wouldn't they choose Node where type checking can also be enabled with a bit of work? You might also consider the marketing value of all those "Improve Deno startup performance by NNNN% with this one weird trick" articles that will disappear if type checking is off by default. |
Beta Was this translation helpful? Give feedback.
-
Not to be redundant, but the idea of not checking types by default in a language whose entire purpose is better type safety than an almost-identical language for which there is already a runtime strikes me as incredibly bad, the stated reasons worse[1], and the whole thing pointless given that
My fear is that type checking being off by default will lead to new users (or old users who forget to [1] "The goal of the Deno CLI is to be a fun and productive" Maybe some people think it is fun and productive to run invalid code. I would suggest they go use PHP, for I am much more productive and find it more fun to code when errors are caught by the compiler, not by myself or a user weeks later when they run into a null pointer or a string being passed where I expected a number. [2] I have worked with other programmers. This outcome is not theoretical. |
Beta Was this translation helpful? Give feedback.
-
I think most people miss the point when arguing why type checking is good. Type checking is certainly good! That is not the question here. Deno is a runtime. Deno runs code. The actual question is: what does "run" mean? Should "run" mean "type check, and if successful then run" or should it actually mean "run"? In other words: when running the code do you actually want to run it? I'd like to present three reasons why I think "run" should in fact mean "run".
Other arguments like shorter startup time are certainly nice, but I wouldn't put it as the main argument here. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/TypeStrong/ts-node/releases/tag/v6.0.0 |
Beta Was this translation helpful? Give feedback.
-
Why do people here claim editors don't use type checker? Obviously they do. I want to see type error when I write code. What is usually done is that the plugin in editor is type-checking, while some bundler like vite, webpack, is not type-checking, but compiling. If you don't want type checking, name your files .js |
Beta Was this translation helpful? Give feedback.
-
Instead of
--no-check
consider type checking TypeScript as an opt-in with a--check
option.Beta Was this translation helpful? Give feedback.
All reactions