Classes
Classes
interface Point {
x: number,
y: number
}
class Point {
x:number;
private y:number;
draw() {
console.log(this.x);
}
constructor(x:number, y:number){
this.x = x;
this.y = y;
}
}
let point = new Point(1, 2);
point.draw();
point.x;Everything public, but use private when you need it
Can autogenerate fields and set it properly just by defining it in the constructor with private/public.
Properties
Simplify syntax, dont need both get and set.
Optional Parameters
Can't have multiple constructors or functions with different type definitions, so adding a question mark after a parameter makes it optional
Everything after the first optional parameter should be optional too
url = "https://poptake-videos.s3.us-west-2.amazonaws.com/test_jorge/2022-09-16T18%3A25%3A23.890Z-video.webm"
ReactPhoenixWeb.Helpers.AWSHelper.presign_s3_url(url)
Last updated