-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: drop ts type inference for event source (#706)
fix error with dependency types and add test to catch install issues in the future closes #705
- Loading branch information
Showing
13 changed files
with
106 additions
and
14 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
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 |
---|---|---|
|
@@ -26,3 +26,6 @@ build/Release | |
# typescript lives in src, output in lib | ||
lib/ | ||
.vscode | ||
|
||
# test files | ||
/test-package |
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo -e "\nTesting that the package can be installed in another project and compiled with TypeScript without errors" | ||
|
||
TEST_DIR="test-package" | ||
mkdir "$TEST_DIR" | ||
|
||
cp scripts/test-package/test-tsconfig.json "$TEST_DIR/tsconfig.json" | ||
cp scripts/test-package/test-package.json "$TEST_DIR/package.json" | ||
cd "$TEST_DIR" | ||
npm install --install-links | ||
mkdir src | ||
echo -e "import { Unleash } from 'unleash-client';\nvoid Unleash;\nconsole.log('Hello world');" > src/index.ts | ||
./node_modules/.bin/tsc -b tsconfig.json | ||
|
||
if [ "$(node . 2>&1)" = "Hello world" ]; then | ||
echo "Output is correct" | ||
(cd .. && rm -rf "$TEST_DIR") | ||
else | ||
echo "Output is incorrect" >&2 | ||
echo $(node . 2>&1) | ||
(cd .. && rm -rf "$TEST_DIR") | ||
exit 1 | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "test", | ||
"version": "1.0.0", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "tsc" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"description": "", | ||
"devDependencies": { | ||
"typescript": "^5.7.3" | ||
}, | ||
"dependencies": { | ||
"unleash-client": "file:.." | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitOverride": true, | ||
"noImplicitReturns": true, | ||
"declaration": true, | ||
"inlineSourceMap": true, | ||
"pretty": true, | ||
"noImplicitAny": true, | ||
"allowJs": false, | ||
"resolveJsonModule": true, | ||
"composite": true, | ||
"outDir": "./lib", | ||
"rootDir": "./src" | ||
}, | ||
"include": ["src/**/*"] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { EventSource as moduleToPatch } from 'launchdarkly-eventsource'; | ||
|
||
export const EventSource = moduleToPatch; // Re-export from .js file, because the original module doesn't have types |
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
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
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
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
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
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