From aed59924ccb8a46b90ae295e41f735b9afc6abc2 Mon Sep 17 00:00:00 2001 From: "E. Cooper" Date: Mon, 29 Jul 2024 14:41:40 -0700 Subject: [PATCH 1/2] Update docstring and readme with changes requested in #277 --- README.md | 6 ++++++ src/client.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d6b20e2..790d04b5 100644 --- a/README.md +++ b/README.md @@ -602,6 +602,12 @@ Don't forget to give the project a star! Thanks again! 1. Start a docker desktop or other docker platform. 2. Run `yarn test`. This will start local fauna containers, verify they're up and run all tests. +### Asserting type behavior + +In cases where you are modifying types and need to test type enforcement, you can use `@ts-expect-error`. Using `@ts-expect-error` will supress any type errors on the following line. Conversely, if there's no error, TypeScript will report its usage as not being neccessary. + +To learn more about `@ts-expect-error`, you can read more about it in the TypeScript [release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-ts-expect-error-comments). + ### Lint your code Linting runs automatically on each commit. diff --git a/src/client.ts b/src/client.ts index ad4e3b15..70f9df6e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -271,7 +271,7 @@ export class Client { /** * Initialize a streaming request to Fauna * @typeParam T - The expected type of the response from Fauna. T can be inferred - * if theprovided query used a type parameter. + * if the provided query used a type parameter. * @param query - A string-encoded streaming token, or a {@link Query} * @returns A {@link StreamClient} that which can be used to listen to a stream * of events From 195b90ca4bca42fb374b169d2aeda66f65da4090 Mon Sep 17 00:00:00 2001 From: "E. Cooper" Date: Mon, 29 Jul 2024 14:45:54 -0700 Subject: [PATCH 2/2] Add new asserting types such to readme toc --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 790d04b5..344b6d7a 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ See the [Fauna Documentation](https://docs.fauna.com/fauna/current/) for additio - [Contributing](#contributing) - [Set up the repo](#set-up-the-repo) - [Run tests](#run-tests) + - [Asserting types](#asserting-types) - [Lint your code](#lint-your-code) - [License](#license) @@ -602,7 +603,7 @@ Don't forget to give the project a star! Thanks again! 1. Start a docker desktop or other docker platform. 2. Run `yarn test`. This will start local fauna containers, verify they're up and run all tests. -### Asserting type behavior +### Asserting types In cases where you are modifying types and need to test type enforcement, you can use `@ts-expect-error`. Using `@ts-expect-error` will supress any type errors on the following line. Conversely, if there's no error, TypeScript will report its usage as not being neccessary.