chore: update ts parser for description comment fixes and generic types (#28709)

* chore: update ts parser for description comment fixes

* docs: strongly type the getUserDefault API

* spec: add getUserMedia type assertions to smoke run
This commit is contained in:
Samuel Attard 2021-04-19 11:44:58 -07:00 committed by GitHub
parent ac9ec1a6ea
commit 400d7c4bce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 19 deletions

View file

@ -0,0 +1,12 @@
# UserDefaultTypes Object
* `string` String
* `boolean` Boolean
* `integer` Number
* `float` Number
* `double` Number
* `url` String
* `array` Array\<unknown>
* `dictionary` Record\<string, unknown>
This type is a helper alias, no object will never exist of this type.

View file

@ -159,13 +159,13 @@ Same as `unsubscribeNotification`, but removes the subscriber from `NSWorkspace.
Add the specified defaults to your application's `NSUserDefaults`.
### `systemPreferences.getUserDefault(key, type)` _macOS_
### `systemPreferences.getUserDefault<Type extends keyof UserDefaultTypes>(key, type)` _macOS_
* `key` String
* `type` String - Can be `string`, `boolean`, `integer`, `float`, `double`,
* `type` Type - Can be `string`, `boolean`, `integer`, `float`, `double`,
`url`, `array` or `dictionary`.
Returns `any` - The value of `key` in `NSUserDefaults`.
Returns [`UserDefaultTypes[Type]`](structures/user-default-types.md) - The value of `key` in `NSUserDefaults`.
Some popular `key` and `type`s are: