Skip to content

Commit d8b2606

Browse files
committed
docs(decorator): fix example
1 parent 780059c commit d8b2606

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/decorator.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ inst1.count // 1
251251

252252
```typescript
253253
function functionCallable(
254-
value as any, {kind} as any
255-
) {
254+
value:any, {kind}:any
255+
):any {
256256
if (kind === 'class') {
257-
return function (...args) {
257+
return function (...args:any) {
258258
if (new.target !== undefined) {
259259
throw new TypeError('This function can’t be new-invoked');
260260
}
@@ -265,10 +265,13 @@ function functionCallable(
265265

266266
@functionCallable
267267
class Person {
268-
constructor(name) {
268+
name:string;
269+
constructor(name:string) {
269270
this.name = name;
270271
}
271272
}
273+
274+
// @ts-ignore
272275
const robin = Person('Robin');
273276
robin.name // 'Robin'
274277
```

0 commit comments

Comments
 (0)