-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(NODE-3331): offer downleveled types for legacy typescript versio…
…ns (#2859)
- Loading branch information
Showing
7 changed files
with
146 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
#!/bin/bash | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
|
||
export PROJECT_DIRECTORY="$(pwd)" | ||
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts" | ||
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
|
||
npm run check:lint | ||
|
||
echo "Typescript $(npx tsc -v)" | ||
# check resolution uses the default latest types | ||
echo "import * as mdb from '.'" > file.ts && npx tsc --noEmit --traceResolution file.ts | grep 'mongodb.d.ts' && rm file.ts | ||
|
||
npm i --no-save [email protected] # there is no 4.0.0 | ||
echo "Typescript $(npx tsc -v)" | ||
npx tsc --noEmit mongodb.ts34.d.ts | ||
# check that resolution uses the downleveled types | ||
echo "import * as mdb from '.'" > file.ts && npx tsc --noEmit --traceResolution file.ts | grep 'mongodb.ts34.d.ts' && rm file.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,12 @@ For version compatibility matrices, please refer to the following links: | |
- [MongoDB](https://docs.mongodb.com/drivers/node/compatibility#mongodb-compatibility) | ||
- [NodeJS](https://docs.mongodb.com/drivers/node/compatibility#language-compatibility) | ||
|
||
#### Typescript Version | ||
|
||
We recommend using the latest version of typescript, however we do provide a [downleveled](https://github.com/sandersn/downlevel-dts#readme) version of the type definitions that we test compiling against `[email protected]`. | ||
Since typescript [does not restrict breaking changes to major versions](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes) we consider this support best effort. | ||
If you run into any unexpected compiler failures please let us know and we will do our best to correct it. | ||
|
||
## Installation | ||
|
||
The recommended way to get started using the Node.js 4.0 driver is by using the `npm` (Node Package Manager) to install the dependency in your project. | ||
|
Oops, something went wrong.