(
target: T,
annotations?: AnnotationsMap<T, NoInfer<AdditionalKeys>>,
options?: MakeObservableOptions
)
| 25 | type MakeObservableOptions = Omit<CreateObservableOptions, "proxy"> |
| 26 | |
| 27 | export function makeObservable<T extends object, AdditionalKeys extends PropertyKey = never>( |
| 28 | target: T, |
| 29 | annotations?: AnnotationsMap<T, NoInfer<AdditionalKeys>>, |
| 30 | options?: MakeObservableOptions |
| 31 | ): T { |
| 32 | initObservable(() => { |
| 33 | const adm: ObservableObjectAdministration = asObservableObject(target, options)[$mobx] |
| 34 | if (__DEV__ && annotations && target[storedAnnotationsSymbol]) { |
| 35 | die( |
| 36 | `makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.` |
| 37 | ) |
| 38 | } |
| 39 | // Default to decorators |
| 40 | annotations ??= collectStoredAnnotations(target) |
| 41 | |
| 42 | // Annotate |
| 43 | ownKeys(annotations).forEach(key => adm.make_(key, annotations![key])) |
| 44 | }) |
| 45 | return target |
| 46 | } |
| 47 | |
| 48 | // proto[keysSymbol] = new Set<PropertyKey>() |
| 49 | const keysSymbol = Symbol("mobx-keys") |
searching dependent graphs…