ts-quiz— ~/loading.ts
tsc --watch● loading…
// tsc --watch · type-checking modules…
await load("loading.ts")
// streaming server components
◇ tsc 6.0.3 · compiling…UTF-8◇ loading…
class Desc:
def __set_name__(self, owner, name):
self.name = '_' + name
def __get__(self, obj, t=None):
return getattr(obj, self.name, 0)
def __set__(self, obj, v):
setattr(obj, self.name, v * 2)
class A:
x = Desc()
a = A(); a.x = 5
print(a.x)