• Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit
Tech News, Magazine & Review WordPress Theme 2017
  • Tech
    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook Reels app on a smartphone on a yellow background

    How to Hide Reels on Facebook

    6 Android Apps for Budget Management

    Meta lays off 11,000 workers as it faces competition from TikTok

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    Pixel Watch in the test

    Google Pixel Watch in the Test

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    US midterm results latest: Republicans win 218 seats to take House as Kevin McCarthy wins initial GOP speaker vote

    US midterm results latest: Republicans win 218 seats to take House as Kevin McCarthy wins initial GOP speaker vote

    Google Pixel Watch

    Your Pixel Watch is Getting Better at Sleep Tracking

    Analyst: iPhone 14 Plus Sales Lagged Behind iPhone 13 Mini, Strategy 'Failed'

    Apple’s Emergency SOS Service for iPhone 14 Goes Live in US and Canada

    Pixel 7 Pro hazel top down view with display on

    Survey shows few people have had major issues with the Pixel 7 series

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Gaming
    The Growth of Mobile Gaming and Its Impact on the Industry

    The Growth of Mobile Gaming and Its Impact

    Discover the Top Five GBA Emulators for iOS 15!

    Discover the Top Five GBA Emulators for iOS 15!

    Discord on Xbox is dropping its reliance on your phone

    Xbox rolls out official support for Discord, Lightstream, and Streamlabs

    Samsung brings Xbox Cloud Gaming and GeForce Now to 2021 sets

    Samsung brings Xbox Cloud Gaming and GeForce Now to 2021 sets

    Virtual Gaming Revolution Continuing To Develop

    Virtual Gaming Revolution Continuing To Develop

    How to Set Custom Shortcuts for Xbox Game Bar in Windows

    How to Set Custom Shortcuts for Xbox Game Bar in Windows

  • Crypto
    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook Reels app on a smartphone on a yellow background

    How to Hide Reels on Facebook

    6 Android Apps for Budget Management

    Meta lays off 11,000 workers as it faces competition from TikTok

  • Business
    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook Reels app on a smartphone on a yellow background

    How to Hide Reels on Facebook

    6 Android Apps for Budget Management

    Meta lays off 11,000 workers as it faces competition from TikTok

No Result
View All Result
Geeky Insider
  • Tech
    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook Reels app on a smartphone on a yellow background

    How to Hide Reels on Facebook

    6 Android Apps for Budget Management

    Meta lays off 11,000 workers as it faces competition from TikTok

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    Pixel Watch in the test

    Google Pixel Watch in the Test

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    Top 5 Websites To Buy Camera Lenses At Reasonable Price

    US midterm results latest: Republicans win 218 seats to take House as Kevin McCarthy wins initial GOP speaker vote

    US midterm results latest: Republicans win 218 seats to take House as Kevin McCarthy wins initial GOP speaker vote

    Google Pixel Watch

    Your Pixel Watch is Getting Better at Sleep Tracking

    Analyst: iPhone 14 Plus Sales Lagged Behind iPhone 13 Mini, Strategy 'Failed'

    Apple’s Emergency SOS Service for iPhone 14 Goes Live in US and Canada

    Pixel 7 Pro hazel top down view with display on

    Survey shows few people have had major issues with the Pixel 7 series

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Gaming
    The Growth of Mobile Gaming and Its Impact on the Industry

    The Growth of Mobile Gaming and Its Impact

    Discover the Top Five GBA Emulators for iOS 15!

    Discover the Top Five GBA Emulators for iOS 15!

    Discord on Xbox is dropping its reliance on your phone

    Xbox rolls out official support for Discord, Lightstream, and Streamlabs

    Samsung brings Xbox Cloud Gaming and GeForce Now to 2021 sets

    Samsung brings Xbox Cloud Gaming and GeForce Now to 2021 sets

    Virtual Gaming Revolution Continuing To Develop

    Virtual Gaming Revolution Continuing To Develop

    How to Set Custom Shortcuts for Xbox Game Bar in Windows

    How to Set Custom Shortcuts for Xbox Game Bar in Windows

  • Crypto
    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook Reels app on a smartphone on a yellow background

    How to Hide Reels on Facebook

    6 Android Apps for Budget Management

    Meta lays off 11,000 workers as it faces competition from TikTok

  • Business
    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

    Enhance your omnichannel service strategies with data-driven insights.

    Black Market for Fraudulent Ad Accounts Found on Facebook

    Sen. Mark Warner and Sen. Marco Rubio at a hearing.

    Trump’s TikTok ban might have been right after all

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    14 Gift Ideas for the Home Chef (2022): Vitamix, Cookbooks, and More

    6 Android Apps for Budget Management

    Twitter, Facebook, Lyft layoffs spark fears of dotcom crash 2.0

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook layoffs are a reminder that your job won’t love you back

    Facebook Reels app on a smartphone on a yellow background

    How to Hide Reels on Facebook

    6 Android Apps for Budget Management

    Meta lays off 11,000 workers as it faces competition from TikTok

Submit
Geeky Insider
No Result
View All Result

What Microsoft’s ES Type Syntax Proposal Means For JavaScript

by Staff Writer
September 20, 2022
in Microsoft
Reading Time: 7 mins read
Illustration showing the JavaScript logo
Share on FacebookShare on Twitter

JavaScript could soon have its own type syntax if a proposal submitted by Microsoft and other developers earlier this year becomes a part of the ECMAScript standard. The initiative plans to add “types as comments” support to the JavaScript language, letting developers annotate code with type information that’ll be used by other ecosystem components.

The Syntax

The proposed syntax looks like this:

READ ALSO

What Are Windows Runtime Errors and How Do You Fix Them?

What Are Windows Runtime Errors and How Do You Fix Them?

November 15, 2022
PC Game Performance Can Drop With Windows 11 22H2, Microsoft Warns

PC Game Performance Can Drop With Windows 11 22H2, Microsoft Warns

November 14, 2022

function sayAge(name: string, age: number) {
console.log(`${name} is ${age} years old.`);
}
 
sayAge(“JavaScript”, 26);

It’ll be familiar to anyone who’s previously used TypeScript, Microsoft’s typed superset of JavaScript. TypeScript has gained widespread adoption across the industry; this new proposal purports to bring some of its benefits to the wider JavaScript world.

What Isn’t The Proposal?

If it gets approved, this proposal will let you write perfectly valid JavaScript with the type annotations shown above. It’ll be accepted by JavaScript runtimes such as web browsers, Node.js, and Deno that respect the ES standard.

The proposal doesn’t actually extend the JavaScript language though. Your type annotations will be exactly that: inert metadata that have no effect on the JavaScript compiler or your code’s runtime. A function call such as the following would work at runtime:

function sayAge(name: string, age: number) {
console.log(`${name} is ${age} years old.`);
}
 
// “age” is a string when it should be a number, but this is still allowed
sayAge(“JavaScript”, “twenty”);

The idea is to offer a new type syntax that’s officially supported but completely ignored by engines. The only change for implementations concerns recognizing and stripping out type annotations wherever they’re used.

The proposal would seek to establish support annotating the types of parameters, variables, and class properties. It’d also look at adding an interface keyword, assertion operators like ! and as, and a ? modifier to mark types as optional. The intention is for all these elements to mirror TypeScript; as with any Stage 0 proposal, the final outcome may work differently though.

What’s The Point?

If type annotations won’t change your program, the obvious question is whether they’re worth having. The proposal argues “yes” because of the syntax’s ability to shorten iteration times and reduce the burden around modern JavaScript toolchains.

Writing type-safe code currently requires you to use TypeScript, a different language flavor that adds dependencies to your project and necessitates a manual compilation step. That code may then pass through other tools such as a module bundler and transpiler before your final JavaScript is produced for distribution. It adds up to a complex toolchain with multiple moving parts.

Although JavaScript is an inherently loosely typed language, the benefits of strong typing are now broadly recognized by the community. This much is evident from the momentum surrounding the TypeScript project. Static typing was also the clear leader in the 2021 State of JS survey’s “missing feature” question.

Adding a type syntax to JavaScript itself would let you get some of the benefits of TypeScript without having to compile your code. This simplifies project set up and maintenance while evolving JavaScript to better align with modern development practices.

Over the past several years, more code has begun to migrate back towards a “pure JavaScript” approach. The decline of legacy browsers makes transpilation less necessary than it once was – the majority of modern implementations offer full support for features like classes, arrow functions, block-scoped variables, and async/await. JavaScript’s even got a fully-fledged module system that works across engines, including in browsers.

Only a few years ago a lengthy toolchain was required to be able to write these features into your code with confidence it would work on users’ devices. Nowadays developers can safely put those build processes aside, returning to the original JavaScript model of referencing files with <script> tags.

Types are one of the few remaining areas of the JavaScript ecosystem that aren’t accommodated by the language itself. Love them or hate them, there’s no denying that types have become an integral part of JavaScript development for many teams and projects. The syntax proposal formally recognizes this fact. It attempts to bring a degree of type support to JavaScript without breaking existing code or enforcing performance-hitting runtime type checks.

What Should Types Actually Do?

The role of a “type” varies between languages. The common demoninator lies in a type’s ability to express the type of data a particular variable will hold. Additional meanings, capabilities, and behaviors are then layered on that foundation.

In statically typed compiled languages like C# and Java, types are enforced at compilation time. It’s impossible to compile a program when you’ve got type incompatibilities in your code. In interpreted languages with optional strong typing, of which PHP is an example, types are enforced at runtime – the program throws an error when a value’s type is incompatible with the context in which it’s used.

An active debate within the JavaScript community has been how far any built-in type system’s remit should extend. This proposal limits its role to the most foundational element, a simple documentation of a value’s expected type. This aligns well with TypeScript’s position as an erasable type syntax that’s ignored at runtime.

The purpose of this model is to give developers instant feedback about potential bugs as they write code. You could get information about type issues as you write regular JavaScript in a compatible IDE. If you wanted to, you could also use a supporting tool such as TypeScript, a static analyzer, or a bundler to audit your source on-demand. This could block a deployment in your CI pipelines when a type issue is present.

The current feeling is that these capabilities are sufficient to align JavaScript with the most common developer needs. Features found in other languages such as introspection and reflection are not commonly needed within the JavaScript ecosystem, in part because developers have become used to TypeScript’s erasure approach.

The Existing Alternative: Docblocks

It’s worth noting that something similar to the proposed erased annotations syntax already exists: familiar JSDoc tags are commonly used to add type details to plain JavaScript code:

/**
* @param name {string}
* @param age {number}
*/

function sayAge(name, age) {
console.log(`${name} is ${age} years old.`);
}

JSDoc comments are supported by various popular tools. However, they’re not a standardized part of the language and they require you to mix details of your code’s operation – its expected types – with the human-centric documentation comprising the rest of the docblock.

JSDoc’s syntax is also very verbose. Besides the required tag names, it typically requires repetition of elements already existing in your code, such as the parameter names in the example above. If you modify a parameter in the function’s signature, you must remember to change the JSDoc tag too.

The new syntax proposal may be functionally equivalent to docblocks but it offers a much more streamlined experience. Types sit alongside their targets as part of your source, instead of in a docblock that you need to separately author and maintain.

What’s Next?

Microsoft’s TypeScript team and co-authors including Bloomberg, Igwalia, and several independent contributors submitted the Stage 0 proposal in the March 2022 TC39 plenary. The proposal has since progressed into Stage 1. Acceptance is still some way off though, with implementation inside engines potentially not arriving for “years.”

The overarching objective of this proposal is to balance JavaScript’s long tail of untyped code with the current demand for a more statically typed development experience. The use of an erased fully optional syntax guarantees backwards compatibility but raises the prospect that it’ll be ineffective at encouraging adoption and consolidating the ecosystem. The debate around this one looks set to grow with new opinions and perspectives as the proposal progresses through the standards track.



Source by www.howtogeek.com

Related Posts

Get access to Microsoft Office for only $40
Microsoft

Get access to Microsoft Office for only $40

November 17, 2022
Ansys-Microsoft Solution Enables Electromagnetic Analysis of Entire Chip Designs
Microsoft

Ansys-Microsoft Solution Enables Electromagnetic Analysis of Entire Chip Designs

November 16, 2022
How to Fix the Printer Error “0x0000011b” on Windows
Microsoft

How to Fix the Printer Error “0x0000011b” on Windows

November 16, 2022
Microsoft announces new supply chain management tools
Microsoft

Microsoft announces new supply chain management tools

November 16, 2022

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

Google devices, including the unreleased Pixel 7 Pro, Pixel 7, Pixel Watch, and Pixel Tablet.

Google’s Pixel 7 launching in October, new leak claims

August 2, 2022
Intel Arc GPUs may suffer launch delays

Leaked roadmaps appear to confirm Intel Arc GPU launch delays

July 30, 2022

Trending.

Top Photo Editing Apps For Android 2022

10 Top Photo Editing Apps For Android 2022

October 26, 2022
What is Stakeholder Management? The Ultimate Guide

What is Stakeholder Management? The Ultimate Guide

May 4, 2023
Top 10 Best Mobile Tracker Apps

Top 10 Best Mobile Tracker Apps

December 3, 2022
Employee Onboarding Trends

7 Employee Onboarding Trends That You Should Know

May 6, 2023
Illuminated network diagram in the shape of a brain

TensorFlow, PyTorch, and JAX: Choosing a deep learning framework

August 30, 2022
Geeky Insider

Geeky Insider is Web based independent Tech Magazine covering Topics Related to Technology, Gadgets, Software, Gaming, Crypto, Business And So on. Read More...

Submit a Techy Post | Write For Us

Feel free to contact us for submission queries. via contact form or email us at [email protected].

Categories

  • Android
  • Apple
  • Apps And Softwares
  • Articles
  • Business
  • Camera
  • Crypto
  • Education
  • Entertainment
  • Gadget and Gear
  • Gaming
  • How To
  • Laptop
  • Marketing
  • Microsoft
  • Review
  • Security
  • Smartphone
  • Technology
How to prevent phishing attacks

How to Prevent Phishing Attacks: Safeguarding Your Digital Identity

May 14, 2023
The Growth of Mobile Gaming and Its Impact on the Industry

The Growth of Mobile Gaming and Its Impact

May 9, 2023
What is Stakeholder Management? The Ultimate Guide

What is Stakeholder Management? The Ultimate Guide

May 4, 2023
  • Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit

© 2022 GeekyInsider.com

No Result
View All Result
  • Home
  • Review
  • Apple
  • Gaming
  • Gadget and Gear
    • Camera
    • Smartphone
  • Microsoft
  • Security