Skip to content

Commit

Permalink
fix doc and address nits
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Nov 21, 2019
1 parent b147018 commit cfa27e8
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

```typescript
readonly config: {
get: <T = ConfigSchema>() => T;
get: <T extends object = ConfigSchema>() => T;
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ The available core services passed to a `PluginInitializer`
<b>Signature:</b>

```typescript
export interface PluginInitializerContext<ConfigSchema = unknown>
export interface PluginInitializerContext<ConfigSchema extends object = object>
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [config](./kibana-plugin-public.plugininitializercontext.config.md) | <code>{</code><br/><code> get: &lt;T = ConfigSchema&gt;() =&gt; T;</code><br/><code> }</code> | |
| [config](./kibana-plugin-public.plugininitializercontext.config.md) | <code>{</code><br/><code> get: &lt;T extends object = ConfigSchema&gt;() =&gt; T;</code><br/><code> }</code> | |
| [env](./kibana-plugin-public.plugininitializercontext.env.md) | <code>{</code><br/><code> mode: Readonly&lt;EnvironmentMode&gt;;</code><br/><code> packageInfo: Readonly&lt;PackageInfo&gt;;</code><br/><code> }</code> | |
| [opaqueId](./kibana-plugin-public.plugininitializercontext.opaqueid.md) | <code>PluginOpaqueId</code> | A symbol used to identify this plugin in the system. Needed when registering handlers or context providers. |

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const configSchema = schema.object({
type ConfigType = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<ConfigType> = {
exposeToBrowser: ['uiProp'],
exposeToBrowser: {
uiProp: true,
},
schema: configSchema,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Dedicated type for plugin configuration schema.
<b>Signature:</b>

```typescript
export declare type PluginConfigSchema<T = unknown> = Type<T>;
export declare type PluginConfigSchema<T> = Type<T>;
```
4 changes: 2 additions & 2 deletions src/core/public/plugins/plugin_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { CoreSetup, CoreStart } from '../';
*
* @public
*/
export interface PluginInitializerContext<ConfigSchema = unknown> {
export interface PluginInitializerContext<ConfigSchema extends object = object> {
/**
* A symbol used to identify this plugin in the system. Needed when registering handlers or context providers.
*/
Expand All @@ -40,7 +40,7 @@ export interface PluginInitializerContext<ConfigSchema = unknown> {
packageInfo: Readonly<PackageInfo>;
};
readonly config: {
get: <T = ConfigSchema>() => T;
get: <T extends object = ConfigSchema>() => T;
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,10 @@ export interface Plugin<TSetup = void, TStart = void, TPluginsSetup extends obje
export type PluginInitializer<TSetup, TStart, TPluginsSetup extends object = object, TPluginsStart extends object = object> = (core: PluginInitializerContext) => Plugin<TSetup, TStart, TPluginsSetup, TPluginsStart>;

// @public
export interface PluginInitializerContext<ConfigSchema = unknown> {
export interface PluginInitializerContext<ConfigSchema extends object = object> {
// (undocumented)
readonly config: {
get: <T = ConfigSchema>() => T;
get: <T extends object = ConfigSchema>() => T;
};
// (undocumented)
readonly env: {
Expand Down
6 changes: 4 additions & 2 deletions src/core/server/plugins/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { CoreSetup, CoreStart } from '..';
*
* @public
*/
export type PluginConfigSchema<T = unknown> = Type<T>;
export type PluginConfigSchema<T> = Type<T>;

/**
* Describes a plugin configuration schema and capabilities.
Expand All @@ -48,7 +48,9 @@ export type PluginConfigSchema<T = unknown> = Type<T>;
* type ConfigType = TypeOf<typeof configSchema>;
*
* export const config: PluginConfigDescriptor<ConfigType> = {
* exposeToBrowser: ['uiProp'],
* exposeToBrowser: {
* uiProp: true,
* },
* schema: configSchema,
* };
* ```
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ export interface PluginConfigDescriptor<T = any> {
}

// @public
export type PluginConfigSchema<T = unknown> = Type<T>;
export type PluginConfigSchema<T> = Type<T>;

// @public
export type PluginInitializer<TSetup, TStart, TPluginsSetup extends object = object, TPluginsStart extends object = object> = (core: PluginInitializerContext) => Plugin<TSetup, TStart, TPluginsSetup, TPluginsStart>;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/testbed/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const configSchema = schema.object({

type ConfigType = TypeOf<typeof configSchema>;

export const config: PluginConfigDescriptor<ConfigType> = {
export const config: PluginConfigDescriptor = {
exposeToBrowser: {
uiProp: true,
},
Expand Down

0 comments on commit cfa27e8

Please sign in to comment.