TypeScript just got a whole lot more interesting. So, what's the big deal about this new flag, --erasableSyntaxOnly? It's all about making TypeScript more compatible with JavaScript - and it's related to some major efforts in the Node.js and TC39 communities. You see, when you enable this flag in your tsconfig.json, you'll start getting compile errors for certain TypeScript syntax that's not "erasable". It's not allowed: enum declarations, namespaces with runtime code, and a few other things. Why? Because they can't be simply removed without affecting how your JavaScript code runs. For instance, take a look at this function: it's erasable. Function greet is simple. You can strip away the type, and it'll still work just fine. But enums, on the other hand, are a different story - if you remove one, you'll get a runtime error, and that's not what you want. So, what's driving this change? Well, Node.js 23.6 has a new flag, --experimental-strip-types, which lets you run TypeScript files directly, but it only strips types, and doesn't support enums or namespaces. And then there's the TC39 proposal, "Types as Comments", which wants to make browsers ignore TypeScript type syntax, like it's just a comment. If this proposal succeeds, you'll be able to run TypeScript without a build step - but for that to work, types need to be "erasable". So, what does this mean for your code? You don't need to enable --erasableSyntaxOnly just yet, but for new code, it's a good idea to use alternatives to non-erasable syntax, like using an object with the `as const` keyword instead of an enum. The TypeScript team is not deprecating enums, but they are encouraging you to use alternatives in new code - it's all about innovation, strategy, and creativity in coding. Check out the source for more info: https://lnkd.in/gryaNcAs #TypeScript #Innovation #CodingStrategy
TypeScript Gets More JavaScript Compatible with --erasableSyntaxOnly Flag
More Relevant Posts
-
TypeScript didn’t make JavaScript complex. It made the complexity visible. For years we blamed JavaScript for: - runtime errors - broken refactors - “it worked yesterday” bugs TypeScript didn’t add these problems. It just stopped letting us ignore them. Types are not about being “strict”. They’re about intent. - What does this function expect? - What does it return? - What can be null — and what can’t? - What breaks if I change this? That’s not overhead. That’s documentation that doesn’t lie. Yes, TypeScript can feel annoying at first. Yes, it slows you down… for about two weeks. Then something interesting happens: - refactors get safer - code reviews get easier - onboarding gets faster - production gets quieter The biggest TypeScript benefit isn’t fewer bugs. It’s confidence. Confidence to change code. Confidence to delete code. Confidence to scale a codebase without fear. TypeScript isn’t about types. It’s about engineering discipline. If you’ve worked with both JS and TS at scale, you already know. What was the moment TypeScript “clicked” for you? #typescript #javascript #frontend #softwareengineering #cleanCode #webdevelopment #engineeringCulture #devLife
To view or add a comment, sign in
-
Type Safety and Runtime Validation in JavaScript with Zod and JSDoc Combining Zod's runtime validation with JSDoc's type annotations to achieve type safety in JavaScript without TypeScript. https://lnkd.in/deBkW-Gj #javascript
To view or add a comment, sign in
-
⚠️ Node.js might not be the default choice for AI-heavy JavaScript projects much longer. The JavaScript ecosystem has quietly moved on from framework debates. The real war now is runtime speed and infrastructure cost. Some signals are hard to ignore: - TypeScript is offloading performance-sensitive logic to Go - Vite is moving toward Rust-based Rolldown - Next.js is replacing Webpack with Rust tooling - Gen-UI / AI search experiences becoming alternative to classic SEO-driven traffic. One clear theme 👉 native speed is winning. This is where Bun is playing a different game. Following its acquisition by Anthropic, Bun is no longer just a "fast alternative" to Node. It’s an attempt to replace the entire JavaScript toolchain — runtime, bundler, package manager, test runner — with native performance as the baseline. For AI-heavy workloads, trade-offs change fast: - Cold starts = real money - Memory usage = real infrastructure cost What are you betting on for your next AI-heavy project? The battle-tested stability of Node.js or the native velocity of Bun? 👇 #JavaScript #NodeJS #Bun #AIEngineering #WebDev #SoftwareArchitecture #DeveloperExperience
To view or add a comment, sign in
-
-
JavaScript is powerful, but as applications grow, managing bugs and maintaining code becomes harder. That’s where TypeScript helps 👇 🔹 What is TypeScript? TypeScript is a superset of JavaScript that adds static typing, helping catch errors at compile time and making code more readable and scalable. 🔹 Why TypeScript? ✔ Fewer runtime errors ✔ Better IDE autocomplete ✔ Cleaner, self-documenting code ✔ Widely used with React & Next.js 🔹 Basic Types in TypeScript let title: string = "TypeScript Basics"; let count: number = 10; let isActive: boolean = true; let tags: string[] = ["JavaScript", "TypeScript", "React"]; let user: { name: string; role: string } = { name: "Developer", role: "Frontend" }; ✨ Type Inference let framework = "TypeScript"; // inferred as string TypeScript doesn’t replace JavaScript it makes JavaScript safer, cleaner, and easier to scale 🚀 #TypeScript #JavaScript #WebDevelopment #LearnInPublic #Frontend
To view or add a comment, sign in
-
-
🚀 Why Akshay Saini’s JavaScript Playlist is a Game Changer If you really want to understand JavaScript from the inside, not just write code that somehow works, then Akshay Saini’s JavaScript playlist is hands down one of the best resources out there. What makes this playlist special is not what he teaches, but how he teaches it. 🧠✨ 🔹 Execution Context — explained the right way He breaks down how JavaScript actually runs your code by explaining the Global Execution Context, the Memory Creation Phase, and the Execution Phase. Once you understand this, JavaScript stops feeling confusing and starts feeling logical. 🔹 Hoisting — not a trick, but a concept Instead of calling hoisting a “weird JS behavior”, he defines it properly: 👉 Before the code is executed, memory is allocated to variables and functions. That single explanation clears years of confusion around hoisting. 🔹 Call Stack — visual and intuitive Function calls are no longer mysterious. You clearly see how every function creates its own Local Execution Context, how it gets pushed onto the Call Stack, and how it is removed after execution. This is where debugging skills level up 📈 🔹 Functions create their own world A function call is not just a line of code — it creates an entirely new execution environment with its own variables, scope, and references. After watching this playlist: ✅ JavaScript fundamentals become rock solid ✅ Interviews start making sense ✅ Console errors feel less scary ✅ Confidence in JS increases massively 💪 This is not just a tutorial series. It’s a mindset shift in how you think about JavaScript.
To view or add a comment, sign in
-
Over the past few months, I’ve been noticing how much TypeScript has quietly become a part of everyday frontend development. What used to feel optional now feels almost expected. I remember working on a simple feature where an API field changed from a number to a string. JavaScript didn’t complain. The UI broke at runtime. Production found the bug before we did. After switching that flow to TypeScript, the same issue was caught instantly at compile time. No debugging sessions. No late surprises. Frameworks like Angular made this approach normal early on. And today, React + TypeScript feels like the natural setup for most projects. Types act like documentation that never goes out of sync. Refactoring feels safer. Code reviews focus more on logic and less on “what is this supposed to be?” As someone said perfectly: “JavaScript lets you ship fast. TypeScript lets you sleep peacefully.” 😄 Another favorite: “TypeScript is basically JavaScript with trust issues — and it’s usually right.” TypeScript doesn’t remove all bugs. But it does remove a lot of unnecessary stress. And for growing codebases and teams, that confidence matters. Or in simple terms: “The best bug is the one TypeScript never lets you run.” Frontend development today is less about moving fast at any cost, and more about moving forward with confidence. Would love to hear how TypeScript has changed your frontend workflow. #TypeScript #FrontendDevelopment #ReactJS #Angular #JavaScript #WebDevelopment #DeveloperExperience #CodingLife #SoftwareEngineering
To view or add a comment, sign in
-
🛣️ Roadmap to Master JavaScript (From Zero to Confident 🚀) JavaScript isn’t hard, it’s just wide. The real challenge is knowing what to learn and in what order. This roadmap breaks JavaScript into clear, progressive stages: 🔹 Start with the Basics Variables, data types, operators, conditionals, and loops your foundation. 🔹 Level up with Functions & Objects Understand how JS really works with functions, arrays, objects, and ES6+ features. 🔹 Master the Browser DOM manipulation, events, storage, browser APIs where JavaScript becomes interactive. 🔹 Go Async & Real-World Ready Promises, async/await, fetch, error handling, and debugging. 🔹 Think Like a Pro Closures, event loop, performance optimization, patterns, and testing. 🔹 Build Real Applications Frameworks (React, Vue), backend basics (Node.js), build tools, and workflows. 💡 Tip: Don’t rush. Build small projects at every stage that’s where learning sticks. If you’re starting JavaScript or feeling stuck halfway, save this roadmap and follow it step by step. #JavaScript #WebDevelopment #FrontendDeveloper #FullStackDeveloper #LearnJavaScript #CodingRoadmap #100DaysOfCode #BuildInPublic #ReactJS #NodeJS #ProgrammingJourney
To view or add a comment, sign in
-
-
Have you ever been baffled by TypeScript's type narrowing, only to find out the problem isn't where you first look? 🤔 A couple of weeks ago, I was dealing with a subtle bug. The symptom was simple: a type error that would disappear under one condition but reappear under another without any obvious changes in logic. Here's a snippet that highlights the issue: ```typescript function processInput(input: string | number) { if (typeof input === 'string') { // Do something with the string } // More code that should only be applicable if input is a number console.log(input.toFixed(2)); } ``` In this scenario, TypeScript's type narrowing is expected to "forget" about `input` being a string after the `if` block. But, if additional complex structures or nested functions interact within the `if`, TypeScript can sometimes lose track, and you'll be stuck debugging an input type mismatch. The real headache? This problem rarely shows up in tests and is more likely to cause havoc when you upgrade TypeScript versions, since improvements can introduce new, stricter checks. To fix it, you can use an explicit type guard: ```typescript function isNumber(input: unknown): input is number { return typeof input === 'number'; } function processInput(input: string | number) { if (isNumber(input)) { // Guaranteed to be a number here console.log(input.toFixed(2)); } } ``` Always handle type assertions carefully, and regularly review your TypeScript configuration when upgrading. Have you come across similar issues? Share your experiences below! #TypeScript #JavaScript #CodeDebugging #WebDevelopment #SoftwareEngineering #TypeScript #JavaScript #CodeDebugging #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
TypeScript – Writing JavaScript with Confidence 🚀 JavaScript is powerful, but as projects grow, bugs grow faster. That’s where TypeScript makes a real difference. TypeScript is a superset of JavaScript that adds type safety and better tooling to your code. 🔹 Why developers love TypeScript Catches errors before runtime Makes code more readable & predictable Improves IDE support (auto-complete, refactoring) Scales better for large applications 🔹 Where TypeScript shines Large React applications Team-based projects Long-term maintainable codebases 📌 Key Insight TypeScript doesn’t slow you down — it saves time by preventing bugs early. 🚀 Final Thought TypeScript feels strict at first, but once you get used to it, there’s no going back to plain JavaScript. Are you still using JavaScript, or have you switched to TypeScript? 👇 #TypeScript #JavaScript #WebDevelopment #FrontendDeveloper #ReactJS #MERNStack #TechLearning
To view or add a comment, sign in
-
-
🚀 What’s new in JavaScript (and why it’s actually exciting) JavaScript keeps quietly getting better. Here are 3 recent additions that genuinely improve how we write everyday code: 🔹 1. Built-in Iterator Methods We can now work with iterators using methods like .map(), .filter(), and .take() — without converting them to arrays first. This means cleaner code and lazy evaluation, which can be more memory-efficient and expressive. 🔹 2. New Set Operations (Finally!) JavaScript now supports native set operations like: ->union ->intersection ->difference No more manual loops or helper utilities just to compare sets. This makes working with unique data far more intuitive. 🔹 3. Promise.try() A small but powerful addition. Promise.try() lets you safely start async logic whether the function is sync or async — reducing boilerplate and improving error handling consistency. ✨ These aren’t flashy features, but they remove friction, reduce code noise, and make JavaScript feel more mature as a language. If you’re learning JS or React like me, staying aware of these changes helps you write simpler and more intentional code. Curious to see how these will show up in real projects 👀 #JavaScript #WebDevelopment #Frontend #LearningInPublic #React #ESNext
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development