diff --git a/types/aws-lambda/test/dynamodb-tests.ts b/types/aws-lambda/test/dynamodb-tests.ts index 6d1dfa9d556a65..6cad81e146d71b 100644 --- a/types/aws-lambda/test/dynamodb-tests.ts +++ b/types/aws-lambda/test/dynamodb-tests.ts @@ -1,4 +1,4 @@ -import { DynamoDBBatchResponse, DynamoDBStreamEvent, DynamoDBStreamHandler } from "aws-lambda"; +import { DynamoDBBatchResponse, DynamoDBStreamEvent, DynamoDBStreamHandler, StreamRecord } from "aws-lambda"; // TODO: Update test to read all event properties, and write all result // properties, like the user will. @@ -97,6 +97,17 @@ const event: DynamoDBStreamEvent = { ], }; +const keys: StreamRecord = { + Keys: { + // expect error when using multiple attributes in AttributeValue type + // @ts-expect-error + Id: { + N: "101", + S: "Extra", + }, + }, +}; + const streamHandlerWithResponse: DynamoDBStreamHandler = async (event, context, callback) => { // Check result type let result: DynamoDBBatchResponse; diff --git a/types/aws-lambda/trigger/dynamodb-stream.d.ts b/types/aws-lambda/trigger/dynamodb-stream.d.ts index ac190a39812374..30e39da2d24083 100644 --- a/types/aws-lambda/trigger/dynamodb-stream.d.ts +++ b/types/aws-lambda/trigger/dynamodb-stream.d.ts @@ -3,19 +3,27 @@ import { Handler } from "../handler"; // eslint-disable-next-line @typescript-eslint/no-invalid-void-type export type DynamoDBStreamHandler = Handler; +// eslint-disable-next-line @definitelytyped/strict-export-declare-modifiers, @definitelytyped/no-single-element-tuple-type +type Merge = [{ [K in keyof T]: T[K] }][number]; + +// eslint-disable-next-line @definitelytyped/strict-export-declare-modifiers +type ExclusivePropertyUnion = P extends any + ? Merge<{ [K in Extract]: T[K] } & { [K in Exclude]?: never }> + : never; + // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html -export interface AttributeValue { - B?: string | undefined; - BS?: string[] | undefined; - BOOL?: boolean | undefined; - L?: AttributeValue[] | undefined; - M?: { [id: string]: AttributeValue } | undefined; - N?: string | undefined; - NS?: string[] | undefined; - NULL?: boolean | undefined; - S?: string | undefined; - SS?: string[] | undefined; -} +export type AttributeValue = ExclusivePropertyUnion<{ + B: string; + BOOL: boolean; + BS: string[]; + L: AttributeValue[]; + M: Record; + N: string; + NS: string[]; + NULL: boolean; + S: string; + SS: string[]; +}>; // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html export interface StreamRecord { diff --git a/types/emscripten/emscripten-tests.ts b/types/emscripten/emscripten-tests.ts index 62d644f3671929..bb85037eecc642 100644 --- a/types/emscripten/emscripten-tests.ts +++ b/types/emscripten/emscripten-tests.ts @@ -104,6 +104,12 @@ function FSTest(): void { const bothDevice = FS.createDevice("/", "console", () => 66, (c: number) => console.log(c)); // Returns 'B' (66) const simpleDevice = FS.createDevice("/", "null"); + // Test createDevice.major property access + const majorNumber: number = FS.createDevice.major; + FS.createDevice.major = 128; // Test assignment + // $ExpectType number + FS.createDevice.major; + FS.writeFile("file", "foobar"); FS.symlink("file", "link"); diff --git a/types/emscripten/index.d.ts b/types/emscripten/index.d.ts index 87082b3141cac1..fbbecd971caf74 100644 --- a/types/emscripten/index.d.ts +++ b/types/emscripten/index.d.ts @@ -268,12 +268,16 @@ declare namespace FS { function makedev(ma: number, mi: number): number; function registerDevice(dev: number, ops: Partial): void; function getDevice(dev: number): { stream_ops: StreamOps }; - function createDevice( - parent: string | FSNode, - name: string, - input?: () => number | null | undefined, - output?: (c: number) => any, - ): FSNode; + var createDevice: + & (( + parent: string | FSNode, + name: string, + input?: (() => number | null | undefined) | null, + output?: ((code: number) => void) | null, + ) => FSNode) + & { + major: number; + }; // // core diff --git a/types/md5/package.json b/types/md5/package.json index 9d0e8a5e429b56..2b1f5428ed715c 100644 --- a/types/md5/package.json +++ b/types/md5/package.json @@ -13,10 +13,6 @@ "name": "Bill Sourour", "githubUsername": "arcdev1" }, - { - "name": "Cameron Crothers", - "githubUsername": "jprogrammer" - }, { "name": "Piotr Błażejewicz", "githubUsername": "peterblazejewicz" diff --git a/types/react-reconciler/index.d.ts b/types/react-reconciler/index.d.ts index 036024deb22716..9123efaec383c1 100644 --- a/types/react-reconciler/index.d.ts +++ b/types/react-reconciler/index.d.ts @@ -926,6 +926,10 @@ declare namespace ReactReconciler { type IntersectionObserverOptions = any; + interface BaseErrorInfo { + componentStack?: string; + } + interface Reconciler { createContainer( containerInfo: Container, @@ -934,7 +938,10 @@ declare namespace ReactReconciler { isStrictMode: boolean, concurrentUpdatesByDefaultOverride: null | boolean, identifierPrefix: string, - onRecoverableError: (error: Error) => void, + onUncaughtError: (error: Error, info: BaseErrorInfo & { errorBoundary?: Component }) => void, + onCaughtError: (error: Error, info: BaseErrorInfo) => void, + onRecoverableError: (error: Error, info: BaseErrorInfo) => void, + onDefaultTransitionIndicator: () => void, transitionCallbacks: null | TransitionTracingCallbacks, ): OpaqueRoot;