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
33 changes: 19 additions & 14 deletions types/chrome/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6121,38 +6121,43 @@ declare namespace chrome {
* Permissions: "idle"
*/
export namespace idle {
export type IdleState = "active" | "idle" | "locked";
export interface IdleStateChangedEvent extends chrome.events.Event<(newState: IdleState) => void> {}
/** @since Chrome 44 */
export enum IdleState {
ACTIVE = "active",
IDLE = "idle",
LOCKED = "locked",
}

/**
* Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise.
* @param detectionIntervalInSeconds The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected.
* @since Chrome 116
*/
export function queryState(detectionIntervalInSeconds: number): Promise<IdleState>;
/**
* Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise.
* @param detectionIntervalInSeconds The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected.
* @since Chrome 25
*
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
*/
export function queryState(detectionIntervalInSeconds: number, callback: (newState: IdleState) => void): void;
export function queryState(detectionIntervalInSeconds: number): Promise<`${IdleState}`>;
export function queryState(
detectionIntervalInSeconds: number,
callback: (newState: `${IdleState}`) => void,
): void;

/**
* Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.
* @since Chrome 25
* @param intervalInSeconds Threshold, in seconds, used to determine when the system is in an idle state.
*/
export function setDetectionInterval(intervalInSeconds: number): void;

/**
* Gets the time, in seconds, it takes until the screen is locked automatically while idle. Returns a zero duration if the screen is never locked automatically. Currently supported on Chrome OS only.
* Parameter delay: Time, in seconds, until the screen is locked automatically while idle. This is zero if the screen never locks automatically.
* Gets the time, in seconds, it takes until the screen is locked automatically while idle. Returns a zero duration if the screen is never locked automatically.
*
* Can return its result via Promise in Manifest V3 or later since Chrome 116.
* @since Chrome 73
* @platform ChromeOS only
*/
export function getAutoLockDelay(): Promise<number>;
export function getAutoLockDelay(callback: (delay: number) => void): void;

/** Fired when the system changes to an active, idle or locked state. The event fires with "locked" if the screen is locked or the screensaver activates, "idle" if the system is unlocked and the user has not generated any input for a specified number of seconds, and "active" when the user generates input on an idle system. */
export var onStateChanged: IdleStateChangedEvent;
export const onStateChanged: events.Event<(newState: `${IdleState}`) => void>;
}

////////////////////
Expand Down
28 changes: 28 additions & 0 deletions types/chrome/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4476,6 +4476,34 @@ function testIdentity() {
chrome.identity.removeCachedAuthToken(invalidTokenDetails, () => void 0).then(() => void 0);
}

// https://developer.chrome.com/docs/extensions/reference/api/idle
function testIdle() {
chrome.idle.IdleState.ACTIVE === "active";
chrome.idle.IdleState.IDLE === "idle";
chrome.idle.IdleState.LOCKED === "locked";

chrome.idle.getAutoLockDelay(); // $ExpectType Promise<number>
chrome.idle.getAutoLockDelay(delay => { // $ExpectType void
delay; // $ExpectType number
});
// @ts-expect-error
chrome.idle.getAutoLockDelay(() => {}).then(() => {});

const intervalInSeconds = 2;
chrome.idle.queryState(intervalInSeconds); // $ExpectType Promise<"active" | "idle" | "locked">
chrome.idle.queryState(intervalInSeconds, (newState) => { // $ExpectType void
newState; // $ExpectType "active" | "idle" | "locked"
});
// @ts-expect-error
chrome.idle.queryState(intervalInSeconds, () => {}).then(() => {});

chrome.idle.setDetectionInterval(intervalInSeconds); // $ExpectType void

checkChromeEvent(chrome.idle.onStateChanged, (newState) => {
newState; // $ExpectType "active" | "idle" | "locked"
});
}

// https://developer.chrome.com/docs/extensions/reference/topSites/
function testTopSites() {
chrome.topSites.get(() => {});
Expand Down
5 changes: 5 additions & 0 deletions types/emailjs-utf7/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
42 changes: 42 additions & 0 deletions types/emailjs-utf7/emailjs-utf7-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { decode, encode, encodeAll, imapDecode, imapEncode } from "emailjs-utf7";

// @ts-expect-error
encode();
encode("testing", "testmask"); // $ExpectType string
encode("testing"); // $ExpectType string
// @ts-expect-error
encode(5);
// @ts-expect-error
encode(true);

// @ts-expect-error
encodeAll();
encodeAll("testing"); // $ExpectType string
// @ts-expect-error
encodeAll(5);
// @ts-expect-error
encodeAll(true);

// @ts-expect-error
decode();
decode("BCgEMAQxBDsEPgQ9BEs"); // $ExpectType string
// @ts-expect-error
decode(5);
// @ts-expect-error
decode(true);

// @ts-expect-error
imapEncode();
imapEncode("testing"); // $ExpectType string
// @ts-expect-error
imapEncode(5);
// @ts-expect-error
imapEncode(true);

// @ts-expect-error
imapDecode();
imapDecode("&BCgEMAQxBDsEPgQ9BEs-"); // $ExpectType string
// @ts-expect-error
imapDecode(5);
// @ts-expect-error
imapDecode(true);
34 changes: 34 additions & 0 deletions types/emailjs-utf7/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Encodes string to UTF-7, see RFC 2152
* @param str String to encode
* @param mask (optional) Characters to encode, defaults to RFC 2152 Set D
*/
export function encode(str: string, mask?: string): string;

/**
* Encodes string to UTF-7 with all optionals, see RFC 2152
* @param str String to encode
*/
export function encodeAll(str: string): string;

/**
* Decodes UTF-7 string, see RFC 2152
* @param str String to decode
*/
export function decode(str: string): string;

/**
* Encodes string to UTF-7 with all optionals, see RFC 3501
*
* All printable ASCII chars except for & must be represented by themselves.
* We replace subsequent non-representable chars with their escape sequence.
*
* @param str String to encode
*/
export function imapEncode(str: string): string;

/**
* Decodes UTF-7 string, see RFC 3501
* @param str String to decode
*/
export function imapDecode(str: string): string;
17 changes: 17 additions & 0 deletions types/emailjs-utf7/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"name": "@types/emailjs-utf7",
"version": "4.0.9999",
"projects": [
"https://github.com/emailjs/emailjs-utf7"
],
"devDependencies": {
"@types/emailjs-utf7": "workspace:."
},
"owners": [
{
"name": "Boris Moiseev",
"githubUsername": "cyberbobs"
}
]
}
19 changes: 19 additions & 0 deletions types/emailjs-utf7/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "node16",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"emailjs-utf7-tests.ts"
]
}
2 changes: 1 addition & 1 deletion types/nsqjs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Message extends events.EventEmitter {
body: Buffer;
hasResponded: boolean;
attempts: number;
timestamp: number;
timestamp: bigint;

constructor(rawMessage: Buffer, requeueDelay: number, msgTimeout: number, maxMsgTimeout: number);

Expand Down
29 changes: 19 additions & 10 deletions types/office-js-preview/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,19 +611,28 @@ declare namespace Office {
*/
BindingSelectionChanged,
/**
* Triggers when Dialog has an event, such as dialog closed or dialog navigation failed.
* Occurs when a dialog is closed or when dialog navigation failed.
*
* For guidance on how to implement a dialog in your add-in, see
* {@link https://learn.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Office dialog API in Office Add-ins}.
*/
DialogEventReceived,
/**
* Triggers when a dialog sends a message via `messageParent`.
* Occurs when a dialog sends a message using `Office.context.ui.messageParent`.
*
* For guidance on how to implement a dialog in your add-in, see
* {@link https://learn.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Office dialog API in Office Add-ins}.
*/
DialogMessageReceived,
/**
* Triggers when a host page sends a message to a child dialog box with `messageChild`.
* Occurs when a host page sends a message to a child dialog box with `Dialog.messageChild`.
*
* For guidance on how to implement a dialog in your add-in, see
* {@link https://learn.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Office dialog API in Office Add-ins}.
*/
DialogParentMessageReceived,
/**
* Triggers when a document-level selection happens in Excel or Word.
* Occurs when a document-level selection happens in Excel or Word.
*/
DocumentSelectionChanged,
/**
Expand Down Expand Up @@ -699,15 +708,15 @@ declare namespace Office {
*/
DragAndDropEvent,
/**
* Triggers when a `customXmlPart` node is deleted.
* Occurs when a `customXmlPart` node is deleted.
*/
NodeDeleted,
/**
* Triggers when a `customXmlPart` node is inserted.
* Occurs when a `customXmlPart` node is inserted.
*/
NodeInserted,
/**
* Triggers when a `customXmlPart` node is replaced.
* Occurs when a `customXmlPart` node is replaced.
*/
NodeReplaced,
/**
Expand Down Expand Up @@ -752,7 +761,7 @@ declare namespace Office {
*/
RecurrenceChanged,
/**
* Triggers when a Resource selection happens in Project.
* Occurs when a Resource selection happens in Project.
*/
ResourceSelectionChanged,
/**
Expand Down Expand Up @@ -789,11 +798,11 @@ declare namespace Office {
*/
SpamReporting,
/**
* Triggers when a Task selection happens in Project.
* Occurs when a Task selection happens in Project.
*/
TaskSelectionChanged,
/**
* Triggers when a View selection happens in Project.
* Occurs when a View selection happens in Project.
*/
ViewSelectionChanged
}
Expand Down
29 changes: 19 additions & 10 deletions types/office-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,19 +611,28 @@ declare namespace Office {
*/
BindingSelectionChanged,
/**
* Triggers when Dialog has an event, such as dialog closed or dialog navigation failed.
* Occurs when a dialog is closed or when dialog navigation failed.
*
* For guidance on how to implement a dialog in your add-in, see
* {@link https://learn.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Office dialog API in Office Add-ins}.
*/
DialogEventReceived,
/**
* Triggers when a dialog sends a message via `messageParent`.
* Occurs when a dialog sends a message using `Office.context.ui.messageParent`.
*
* For guidance on how to implement a dialog in your add-in, see
* {@link https://learn.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Office dialog API in Office Add-ins}.
*/
DialogMessageReceived,
/**
* Triggers when a host page sends a message to a child dialog box with `messageChild`.
* Occurs when a host page sends a message to a child dialog box with `Dialog.messageChild`.
*
* For guidance on how to implement a dialog in your add-in, see
* {@link https://learn.microsoft.com/office/dev/add-ins/develop/dialog-api-in-office-add-ins | Use the Office dialog API in Office Add-ins}.
*/
DialogParentMessageReceived,
/**
* Triggers when a document-level selection happens in Excel or Word.
* Occurs when a document-level selection happens in Excel or Word.
*/
DocumentSelectionChanged,
/**
Expand Down Expand Up @@ -699,15 +708,15 @@ declare namespace Office {
*/
DragAndDropEvent,
/**
* Triggers when a `customXmlPart` node is deleted.
* Occurs when a `customXmlPart` node is deleted.
*/
NodeDeleted,
/**
* Triggers when a `customXmlPart` node is inserted.
* Occurs when a `customXmlPart` node is inserted.
*/
NodeInserted,
/**
* Triggers when a `customXmlPart` node is replaced.
* Occurs when a `customXmlPart` node is replaced.
*/
NodeReplaced,
/**
Expand Down Expand Up @@ -752,7 +761,7 @@ declare namespace Office {
*/
RecurrenceChanged,
/**
* Triggers when a Resource selection happens in Project.
* Occurs when a Resource selection happens in Project.
*/
ResourceSelectionChanged,
/**
Expand Down Expand Up @@ -789,11 +798,11 @@ declare namespace Office {
*/
SpamReporting,
/**
* Triggers when a Task selection happens in Project.
* Occurs when a Task selection happens in Project.
*/
TaskSelectionChanged,
/**
* Triggers when a View selection happens in Project.
* Occurs when a View selection happens in Project.
*/
ViewSelectionChanged
}
Expand Down
2 changes: 1 addition & 1 deletion types/three/examples/jsm/Addons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export * from "./loaders/FontLoader.js";
export * from "./loaders/GCodeLoader.js";
export * from "./loaders/GLTFLoader.js";
export * from "./loaders/HDRCubeTextureLoader.js";
export * from "./loaders/HDRLoader.js";
export * from "./loaders/IESLoader.js";
export * from "./loaders/KMZLoader.js";
export * from "./loaders/KTX2Loader.js";
Expand All @@ -108,7 +109,6 @@ export * from "./loaders/PDBLoader.js";
export * from "./loaders/PLYLoader.js";
export * from "./loaders/PVRLoader.js";
export * from "./loaders/RGBELoader.js";
export * from "./loaders/RGBMLoader.js";
export * from "./loaders/STLLoader.js";
export * from "./loaders/SVGLoader.js";
export * from "./loaders/TDSLoader.js";
Expand Down
Loading