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
13 changes: 12 additions & 1 deletion types/aws-lambda/test/dynamodb-tests.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down
32 changes: 20 additions & 12 deletions types/aws-lambda/trigger/dynamodb-stream.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ import { Handler } from "../handler";
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
export type DynamoDBStreamHandler = Handler<DynamoDBStreamEvent, DynamoDBBatchResponse | void>;

// eslint-disable-next-line @definitelytyped/strict-export-declare-modifiers, @definitelytyped/no-single-element-tuple-type
type Merge<T> = [{ [K in keyof T]: T[K] }][number];

// eslint-disable-next-line @definitelytyped/strict-export-declare-modifiers
type ExclusivePropertyUnion<T, P = keyof T> = P extends any
? Merge<{ [K in Extract<keyof T, P>]: T[K] } & { [K in Exclude<keyof T, P>]?: 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<string, AttributeValue>;
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 {
Expand Down
6 changes: 6 additions & 0 deletions types/emscripten/emscripten-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
16 changes: 10 additions & 6 deletions types/emscripten/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,16 @@ declare namespace FS {
function makedev(ma: number, mi: number): number;
function registerDevice(dev: number, ops: Partial<StreamOps>): 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
Expand Down
4 changes: 0 additions & 4 deletions types/md5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
"name": "Bill Sourour",
"githubUsername": "arcdev1"
},
{
"name": "Cameron Crothers",
"githubUsername": "jprogrammer"
},
{
"name": "Piotr Błażejewicz",
"githubUsername": "peterblazejewicz"
Expand Down
9 changes: 8 additions & 1 deletion types/react-reconciler/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,10 @@ declare namespace ReactReconciler {

type IntersectionObserverOptions = any;

interface BaseErrorInfo {
componentStack?: string;
}

interface Reconciler<Container, Instance, TextInstance, SuspenseInstance, FormInstance, PublicInstance> {
createContainer(
containerInfo: Container,
Expand All @@ -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;

Expand Down