Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions types/dom-speech-recognition/dom-speech-recognition-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const speechRecognition2: SpeechRecognition = {
interimResults: false,
lang: "eng",
maxAlternatives: 2,
processLocally: true,
onaudioend: null,
onaudiostart: null,
onend: null,
Expand Down Expand Up @@ -84,3 +85,13 @@ const speechRecognitionErrorEventInit: SpeechRecognitionErrorEventInit = {
message: "abcde",
};
const speechRecognitionErrorEvent = new SpeechRecognitionErrorEvent("type", speechRecognitionErrorEventInit);

const speechRecognitionOptions: SpeechRecognitionOptions = {
langs: ["en-GB"],
processLocally: true,
};

(async () => {
const availability: AvailabilityStatus = await SpeechRecognition.available(speechRecognitionOptions);
const installOutcome: boolean = await SpeechRecognition.install(speechRecognitionOptions);
});
21 changes: 20 additions & 1 deletion types/dom-speech-recognition/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface SpeechRecognition extends EventTarget {
interimResults: boolean;
lang: string;
maxAlternatives: number;
processLocally: boolean;
onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
onend: ((this: SpeechRecognition, ev: Event) => any) | null;
Expand Down Expand Up @@ -56,7 +57,25 @@ interface SpeechRecognition extends EventTarget {
): void;
}

declare var SpeechRecognition: { prototype: SpeechRecognition; new(): SpeechRecognition };
// https://wicg.github.io/speech-api/#dictdef-speechrecognitionoptions
interface SpeechRecognitionOptions {
langs: string[];
processLocally: boolean;
}

type AvailabilityStatus =
| "unavailable"
| "downloadable"
| "downloading"
| "available";

// https://webaudio.github.io/web-speech-api/#speechrecognition
declare var SpeechRecognition: {
prototype: SpeechRecognition;
new(): SpeechRecognition;
available(options: SpeechRecognitionOptions): Promise<AvailabilityStatus>;
install(options: SpeechRecognitionOptions): Promise<boolean>;
};

// https://wicg.github.io/speech-api/#speechrecognitionevent
interface SpeechRecognitionEventInit extends EventInit {
Expand Down
1 change: 1 addition & 0 deletions types/pg/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface PoolConfig extends ClientConfig {
maxUses?: number | undefined;
maxLifetimeSeconds?: number | undefined;
Client?: (new() => ClientBase) | undefined;
onConnect?: ((client: ClientBase) => void) | undefined;
}

export interface QueryConfig<I = any[]> {
Expand Down
2 changes: 1 addition & 1 deletion types/pg/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/pg",
"version": "8.18.9999",
"version": "8.20.9999",
"projects": [
"https://github.com/brianc/node-postgres"
],
Expand Down
13 changes: 13 additions & 0 deletions types/pg/pg-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,16 @@ const bindConfig = {

const con = new Connection();
con.bind(bindConfig, true);

const poolWithOnConnect = new Pool({
onConnect: (client) => {
client.query("SELECT 1").then(result => {
console.log(result.rows[0].number);
});
console.log("onConnect callback is working!");
},
});

poolWithOnConnect.connect().then(client => {
console.log("client connected");
});
92 changes: 80 additions & 12 deletions types/swagger-ui/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ declare namespace SwaggerUI {
name: string;
}>
| undefined;
/**
* Enables overriding configuration parameters via URL search params.
*/
queryConfigEnabled?: boolean | undefined;

// Plugin system

Expand All @@ -45,10 +49,6 @@ declare namespace SwaggerUI {
* for Swagger UI.
*/
layout?: string | undefined;
/**
* A Javascript object to configure plugin integration and behaviors
*/
pluginsOptions?: PluginsOptions;
/**
* An array of plugin functions to use in Swagger UI.
*/
Expand Down Expand Up @@ -132,13 +132,6 @@ declare namespace SwaggerUI {
* Default is the order determined by Swagger UI.
*/
tagsSorter?: SorterLike | undefined;
/**
* When enabled, sanitizer will leave style, class and data-* attributes untouched
* on all HTML Elements declared inside markdown strings.
* This parameter is Deprecated and will be removed in 4.0.0.
* @deprecated
*/
useUnsafeMarkdown?: boolean | undefined;
/**
* Provides a mechanism to be notified when Swagger UI has finished rendering a newly provided definition.
*/
Expand All @@ -164,6 +157,12 @@ declare namespace SwaggerUI {
* Controls whether the "Try it out" section should be enabled by default.
*/
tryItOutEnabled?: boolean | undefined;
/**
* Enables the request snippet section.
* When disabled, the legacy curl snippet will be used.
* The default is false.
*/
requestSnippetsEnabled?: boolean | undefined;
/**
* This is the default configuration section for the the requestSnippets plugin.
*/
Expand Down Expand Up @@ -249,6 +248,36 @@ declare namespace SwaggerUI {
* If set to true, it persists authorization data and it would not be lost on browser close/refresh
*/
persistAuthorization?: boolean | undefined;

// Options missing from https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md

/**
* Inline Plugin Option. See https://github.com/swagger-api/swagger-ui/blob/master/docs/customization/add-plugin.md
*/
components?: Indexable | undefined;
/**
* Inline Plugin Option. See https://github.com/swagger-api/swagger-ui/blob/master/docs/customization/add-plugin.md
*/
fn?: Indexable | undefined;
/**
* See https://github.com/swagger-api/swagger-ui/blob/master/src/core/config/factorization/system.js
*/
configs?: any;
/**
* Passes initial values to the Swagger UI state.
* See https://github.com/swagger-api/swagger-ui/blob/master/src/core/config/factorization/system.js
*/
initialState?: any;
/**
* Used in src/core/plugins/oas3/fn.js
*/
fileUploadMediaTypes?: string[] | undefined;
/**
* Allows to define a custom uncaught exception handler.
* The default is `null`, which means that the default handler will be used.
* The default handler will log the error to the console.
*/
uncaughtExceptionHandler?: ((error: unknown) => unknown) | null | undefined;
}

interface PluginsOptions {
Expand Down Expand Up @@ -313,14 +342,53 @@ declare namespace SwaggerUI {
[index: string]: any;
}

const config: {
defaults: Required<SwaggerUIOptions>;
merge: (target: SwaggerUIOptions, ...sources: SwaggerUIOptions[]) => SwaggerUIOptions;
typeCast: (options: unknown) => SwaggerUIOptions;
typeCastMappings: {
[key in Exclude<keyof SwaggerUIOptions, "queryConfigEnabled">]-?: {
typeCaster: (value: unknown, defaultValue?: SwaggerUIOptions[key]) => SwaggerUIOptions[key] | null;
defaultValue?: SwaggerUIOptions[key];
};
};
};
/**
* Internal presets
* See https://swagger.io/docs/open-source-tools/swagger-ui/customization/overview/#presets
*/
var presets: {
const presets: {
base: SwaggerUIPreset;
apis: SwaggerUIPreset;
};

const plugins: {
Auth: SwaggerUIPlugin;
Configs: SwaggerUIPlugin;
DeepLining: SwaggerUIPlugin;
Err: SwaggerUIPlugin;
Filter: SwaggerUIPlugin;
Icons: SwaggerUIPlugin;
JSONSchema5: SwaggerUIPlugin;
JSONSchema5Samples: SwaggerUIPlugin;
JSONSchema202012: SwaggerUIPlugin;
JSONSchema202012Samples: SwaggerUIPlugin;
Layout: SwaggerUIPlugin;
Logs: SwaggerUIPlugin;
OpenAPI30: SwaggerUIPlugin;
OpenAPI31: SwaggerUIPlugin;
OnComplete: SwaggerUIPlugin;
RequestSnippets: SwaggerUIPlugin;
Spec: SwaggerUIPlugin;
SwaggerClient: SwaggerUIPlugin;
Util: SwaggerUIPlugin;
View: SwaggerUIPlugin;
ViewLegacy: SwaggerUIPlugin;
DownloadUrl: SwaggerUIPlugin;
SyntaxHighlighting: SwaggerUIPlugin;
Versions: SwaggerUIPlugin;
SafeRender: SwaggerUIPlugin;
};
}

interface SwaggerUI {
Expand Down
2 changes: 1 addition & 1 deletion types/swagger-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/swagger-ui",
"version": "5.21.9999",
"version": "5.32.9999",
"projects": [
"https://github.com/swagger-api/swagger-ui"
],
Expand Down
Loading