This commit is contained in:
barsdeveloper
2024-12-11 23:23:23 +02:00
parent 3de0e74ef0
commit e405a7245d
26 changed files with 471 additions and 181 deletions

View File

@@ -146,9 +146,9 @@ export default class IEntity {
* @this {T}
* @returns {T}
*/
static asUniqueClass() {
static asUniqueClass(alwaysCreate = false) {
let result = this
if (this.name.length) {
if (this.name.length || alwaysCreate) {
// @ts-expect-error
result = (() => class extends this { })() // Comes from a lambda otherwise the class will have name "result"
result.grammar = result.createGrammar() // Reassign grammar to capture the correct this from subclass