Message from JavaScript discussions

November 2020

— Works as expected but the compiler does not like it

— 

Https://www.typescriptlang.org/play?#code/IYIwzgLgTsDGEAJYBthjAgggg3gWACgBISYCAS1gXIBMAxcgU2RoC4FgA7ATwG5CSEMpQRgA9gFtGAWUYQAFmJoAKAJS4BRWGM6Rq9JiwQBeBAvJgAdLQbMa-Ylp3jkjS8jEBzZTcM1VDkQAvoQhBIQoaBgAQgiMAB4QjJw0GNj4xKQUVL52JggARACuRbQFDmGE0ZbiUrIKSmoOQA

— Just do this

— I see, Thanks that works.
How can you make sure idField is never undefined by the subclass?

— Hmmmm

— I don't think you can do that for static fields, only instance fields

— Https://stackoverflow.com/a/36113846/2902799

— Here's an example of a method where the subclass is forced to write an implementation

— You *could* hack it to error at runtime I suppose

— Https://www.typescriptlang.org/play?#code/IYIwzgLgTsDGEAJYBthjAgggg3gWACgBISYCAS1gQHMBTRcgEwDFzblGAKASgC4EArgDsA1kID2AdyG5CRIhAAWUKQiG1JCACoBPAA60AolBVROAcgBy4hgFs9yWrdpCItRue4BuOQF85pBRUYOLOALL0iuJc3LLERLDiQpAITKzsjAgAvAhK5GAAdGlsHD7xicnijgXI4tScxRnefoT+BIQoaBgAQgi0AB5uQowY2PjEgZSpLCWZOQBEAgJM82VthN0FIeGR0TxlQA

Message permanent page

— Something like this?

— That helps alot