SlideShare a Scribd company logo
1 of 6
TypeScript 3.7 Language
Standard Conformance
ECMAScript Private Fields
Private Fields
• Prevent users from relying on internals which may change
• Specified by TC39 (Technical Committee 39)
• Authors: Daniel Ehrenberg (Igalia), Jeff Morrison (Facebook)
• Merged with class field declarations proposal
• Stage 3 (Strawperson, Draft, Candidate, Finished)
• Awaits feedback: https://github.com/tc39/proposal-class-fields
• Available online: https://tc39.es/proposal-class-fields/
2019/12/17
ECMAScript Syntax
class Point {
#x;
#y;
constructor(x, y) {
this.#x = x;
this.#y = y;
}
equals(point) {
return this.#x === point.#x && this.#y === point.#y;
}
}
const p1 = new Point(1, 2);
const p2 = new Point(1, 2);
p1.equals(p2); // true
2019/12/17
TypeScript Counterpart
class Point {
private x: number;
private y: number;
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
equals(point: Point) {
return this.x === point.x && this.y === point.y;
}
}
const p1 = new Point(1, 2);
const p2 = new Point(1, 2);
p1.equals(p2); // true
2019/12/17
Implementation Status
• Introduced in Chrome 74
• “SyntaxError: private fields are not currently supported” in Firefox 71
• Expected with TypeScript 3.7
https://github.com/microsoft/TypeScript/issues/33352
2019/12/17
Implementation Status
https://github.com/microsoft/TypeScript/issues/33925#issuecomment-542925717
2019/12/17

More Related Content

Similar to ECMAScript Private Fields in TypeScript 3.7

the productive programer: mechanics
the productive programer: mechanicsthe productive programer: mechanics
the productive programer: mechanics
elliando dias
 
JSLounge - TypeScript 소개
JSLounge - TypeScript 소개JSLounge - TypeScript 소개
JSLounge - TypeScript 소개
Reagan Hwang
 

Similar to ECMAScript Private Fields in TypeScript 3.7 (20)

T1
T1T1
T1
 
GSP 125 Enhance teaching - snaptutorial.com
GSP 125   Enhance teaching - snaptutorial.comGSP 125   Enhance teaching - snaptutorial.com
GSP 125 Enhance teaching - snaptutorial.com
 
the productive programer: mechanics
the productive programer: mechanicsthe productive programer: mechanics
the productive programer: mechanics
 
Enhancing Community Interactions with Data-Driven Chatbots--The DBpedia Chatbot
Enhancing Community Interactions with Data-Driven Chatbots--The DBpedia ChatbotEnhancing Community Interactions with Data-Driven Chatbots--The DBpedia Chatbot
Enhancing Community Interactions with Data-Driven Chatbots--The DBpedia Chatbot
 
JSLounge - TypeScript 소개
JSLounge - TypeScript 소개JSLounge - TypeScript 소개
JSLounge - TypeScript 소개
 
GSP 125 Final Exam Guide
GSP 125 Final Exam GuideGSP 125 Final Exam Guide
GSP 125 Final Exam Guide
 
GSP 125 Exceptional Education - snaptutorial.com
GSP 125 Exceptional Education - snaptutorial.comGSP 125 Exceptional Education - snaptutorial.com
GSP 125 Exceptional Education - snaptutorial.com
 
GSP 125 Education Specialist / snaptutorial.com
  GSP 125 Education Specialist / snaptutorial.com  GSP 125 Education Specialist / snaptutorial.com
GSP 125 Education Specialist / snaptutorial.com
 
Gsp 125 Education Organization -- snaptutorial.com
Gsp 125   Education Organization -- snaptutorial.comGsp 125   Education Organization -- snaptutorial.com
Gsp 125 Education Organization -- snaptutorial.com
 
GSP 125 Technology levels--snaptutorial.com
GSP 125 Technology levels--snaptutorial.comGSP 125 Technology levels--snaptutorial.com
GSP 125 Technology levels--snaptutorial.com
 
Gsp 125 Massive Success / snaptutorial.com
Gsp 125  Massive Success / snaptutorial.comGsp 125  Massive Success / snaptutorial.com
Gsp 125 Massive Success / snaptutorial.com
 
Gsp 125 Enthusiastic Study / snaptutorial.com
Gsp 125 Enthusiastic Study / snaptutorial.comGsp 125 Enthusiastic Study / snaptutorial.com
Gsp 125 Enthusiastic Study / snaptutorial.com
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
The Roslyn Compiler: Look at Your Code from a Different Perspective (Raffaele...
The Roslyn Compiler: Look at Your Code from a Different Perspective (Raffaele...The Roslyn Compiler: Look at Your Code from a Different Perspective (Raffaele...
The Roslyn Compiler: Look at Your Code from a Different Perspective (Raffaele...
 
keynote modelsward 2017
keynote modelsward 2017keynote modelsward 2017
keynote modelsward 2017
 
Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#
 
Gsp 125 final exam guide
Gsp 125 final exam guideGsp 125 final exam guide
Gsp 125 final exam guide
 
Uni texus austin
Uni texus austinUni texus austin
Uni texus austin
 
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...Trends in Programming Technology you might want to keep an eye on af Bent Tho...
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
 
Lecture 3 __c_sharp
Lecture 3 __c_sharpLecture 3 __c_sharp
Lecture 3 __c_sharp
 

Recently uploaded

CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
Wonjun Hwang
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Recently uploaded (20)

Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 

ECMAScript Private Fields in TypeScript 3.7

  • 1. TypeScript 3.7 Language Standard Conformance ECMAScript Private Fields
  • 2. Private Fields • Prevent users from relying on internals which may change • Specified by TC39 (Technical Committee 39) • Authors: Daniel Ehrenberg (Igalia), Jeff Morrison (Facebook) • Merged with class field declarations proposal • Stage 3 (Strawperson, Draft, Candidate, Finished) • Awaits feedback: https://github.com/tc39/proposal-class-fields • Available online: https://tc39.es/proposal-class-fields/ 2019/12/17
  • 3. ECMAScript Syntax class Point { #x; #y; constructor(x, y) { this.#x = x; this.#y = y; } equals(point) { return this.#x === point.#x && this.#y === point.#y; } } const p1 = new Point(1, 2); const p2 = new Point(1, 2); p1.equals(p2); // true 2019/12/17
  • 4. TypeScript Counterpart class Point { private x: number; private y: number; constructor(x: number, y: number) { this.x = x; this.y = y; } equals(point: Point) { return this.x === point.x && this.y === point.y; } } const p1 = new Point(1, 2); const p2 = new Point(1, 2); p1.equals(p2); // true 2019/12/17
  • 5. Implementation Status • Introduced in Chrome 74 • “SyntaxError: private fields are not currently supported” in Firefox 71 • Expected with TypeScript 3.7 https://github.com/microsoft/TypeScript/issues/33352 2019/12/17