One of the things that I like most about TypeScript is that it is a superset of JavaScript. This means that any valid JavaScript code is also valid...
For further actions, you may consider blocking this person and/or reporting abuse
Hi @annabaker ,
About that:
Create react app is NOT using TS by default neither they recommend nor reject TS, because it has no sense. It's not their competence as library, to define which other dependencies you need in the whole project.
It's an option to choose by the developers (usually the TL or LD) taking in mind the specific use-case and it has many pros but some drawbacks as well.
While TS brings some advantages, still JS is the most used in the whole world* and it's in backend where it shines most (Node JS, Deno, Bum...) IMHO.
If you want to use create react app executable along with typescript you need to explicitly state that by using:
Or the yarn equivalent:
Otherwise it will be JS (without TS).
Despite that, it is not recommended to use create-react-app executable for other thing than learning purposes. It is boilerplaty and with all probability will add dependencies that you may not use. It's better to add the dependencies (react, react-dom, a bundler like Webpack or Parcel, jest...) When you're about to use them than using the create-react-app and then start deleting things when you realise you're not using some of them.
Maybe you prefer (or need) Parcel because it's -almost- zero config, or using a different testing suite than what comes along the executable or... Whatever.
As bonus there is more than one way to use TS:
To TS or not to TS, that is NOT the question. Is it?
JoelBonetR ・ Apr 26 ・ 4 min read
Best regards! 😁
*You can search jobs with TypeScript keyword in LinkedIn with some desired filters (or not) and then do the same using JavaScript instead.
Even that I also think that learning TS is a good thing (you'll be able to work in both JS and TS and, using what is explained in the embedded post I added, it will be almost the same with few exceptions).
Thank you so much for your comment! I will check it out!
Hi, its me again, just here to point out again that typescript developers are all also using JavaScript, which is why JavaScript is the most used language... Typescript= JavaScript+ types
And you can look at many trends showing that typescript is by far the most used type system language for JavaScript :) not your weird jsdoc nonsense :)
Of course TS is the most used type system for JavaScript, but that's not the reason for JS being the most used language around the globe.
All TS projects are also JS projects but not all JS projects are TS.
In addition, TS pragma is also TS, and JSDoc has been maintained by TS guys as well in case you didn't know: typescriptlang.org/docs/handbook/j...
Hope it brings some light, like it or not.
You keep repeating "javascript is the most used language" as an argument against typescript... But I guess you're never going to understand how stupid that makes you sound... I'm honestly just here to point it out to others, I realized you're a lost cause several months ago. 2021.stateofjs.com/en-US/other-too...
Oh, just to point out... Literally only 16 out of 11258 respondents to that survey said they strictly use vanilla javascript. I guess there's 15 other people besides you who are insane :)
You own personal interpretation, because community never said that, you are free to use whatever you need to. For instance, in my web company (>500 employees) we do use JS (Vue, corporate framework, etc) because no one except couple of guys (me included) knows TS, so it’s definitely not a good idea about using it widely. Hiring engineers with TS skills isn’t/wasn’t a main task.
That's currently the mainstream, specially in frontend 🤷🏻♀️
Wasn’t talking about trends..
Neither do I, it's just the current state of the market since long time ago.
Trends are spikes in between that and they may cope the market till certain point (see React for example, with more users than Angular, Vue and Svelte together) or set a tendency growing steadily (like TS) or keep living in the community hype for some time without reaching a worth mentioning piece of the market (see Tailwind).
All of them are in a certain situation for good reasons.
Again, i wasn’t talking about it, calm down. Anna stated that “it is recommended to use..” not the case, you can use JS/TS whatever suits you the best. Period
I think the point is still valid. It is recommended to use Typescript where possible over Javascript. It does catch some issues at development time, provides way better feedback on variables and instances in your IDE (and it's 2022, who isn't using an IDE by now?), and it makes you think about the way you write your code.
Of course, as with anything there are ways round all of that if you really want to ignore best practices. You can use
anyfor pretty much all your type declarations, you can force wrong types in at runtime (which won't be caught by the transpiler), and you can just disable warnings given by your IDE.Typescript aims to enhance Javascript, and bring some more modern concepts to the language, such as you'd find on C#, for example. You don't have to use Typescript, but it's recommended that you do because it will make your life easier.
Can i skip javascript and learn typescript instead? does it will be problem
Since TypeScript is a superset of JavaScript, naturally you have to know JavaScript first. TypeScript simply adds properties, specifically statically typed, to your JavaScript code, making it easier to maintain.
ok got it
No cutting corners you have to learn the fundamentals of the language first. It's like trying to learn React before you learned JavaScript 😂
LoL
It’s more like learning a new language without grammar and rules
I also started learning typescript
I'm glad to hear that you're also learning Typescript it's a great language to know.
Is it correct to call TS a language?
Because the engine is JS, only before the engine runs it adds some checks.
Is zend framework or Laravel a language?
I think i will call TypeScript as Javascript Compiler Just like for C or Cpp There is compiler called mingw or clang
Hey!
Thank you for the article!
If you didn't see github.com/type-challenges/type-ch..., you can give it a try, it helped me a lot in the last several years. Especially helpful if you want to dive into challenges and learn more things in details.
The only thing that I didn't like is the lack of detailed explanation
Thank you so much for the kind words! I'm glad you found the article helpful.
I'm always looking for ways to improve my writing, so I appreciate your feedback.
Hi,
I also struggled at the beginning when I started learning typescript, it might be annoying at the beginning but now after 3 years of using it I'd never go back to vanilla JS, I simply love the fact of finding errors at compile time instead of finding them at runtime.
Anyway everyone should use it because it makes you think "better" on your code
You're so right! It can be frustrating at first, but learning typescript is so worth it in the end. It's helped me write much cleaner and more error-free code.
My reason for learning TS :
It's great that you're learning TS! I'm sure you'll be able to use it in many different frameworks and libraries. Keep up the good work :)
Imho, ts is not a language. It's a "typing+" tool for js. And as such, I find adding some ts features into your js is good. Ts has a lot of obscure features, which I think do more harm than good. I think one should not try to apply all ts features religiously. But that's me
:o)One very big benefit of React (for instance) is, it allows you to use js / ts minimally, I find.
I agree, ts is a good tool, but that one should not try to use all of its features all of the time.
Thank you for sharing!
You're welcome!
Take a look github.com/gcanti/fp-ts, more complex project with TS
Thanks I will :)
I like typescript - the only issue I have is getting it to work with the Theme file for material-ui
Hello, for me learning typescript is largely unnecessary because I work alone and I hate oop maybe you can say I am biased but doesn't matter I am ok with javascript as it is
Thank you for your opinion! I respect that you are happy with JavaScript as it is, and as long as you are ok with that's great! For me, I find that learning TypeScript is helpful because it forces me to think about my code in a different way. I also enjoy the challenge of learning something new. :)
Thanks a lot
Simply put, it's a great article.
Thanks!
Good. Here is the typescript boilerplate repo
dev.to/vishalraj82/getting-started...
Hope this helps.
And yes btw :) github.com/JoshuaKGoldberg/TypeStat
Thank you, never heard about that, seems useful for learning purposes and toying around (I'm not confident enough on mutators to use that in a serious project though 😅)
Is TypeScript an OOP? اقوى دعاء لجلب الحبيب