Skip to content
Open
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
1 change: 0 additions & 1 deletion example.ts

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"@mailchimp/mailchimp_marketing": "latest",
"ts-node": "latest",
"typescript": "latest"
}
Expand Down
5 changes: 3 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ n lts
# Install package.json dependencies
yarn

# Run ts-node
yarn ts-node ./example.ts
# Run
yarn tsc --traceResolution
yarn ts-node ./src/index.ts

echo "Process exited with code: $?"
echo
Expand Down
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {foo} from '@mailchimp/mailchimp_marketing';

try {
console.log(foo.indexOf('f'));
} catch(e) {
// we expect to get a runtime error because mailchimp_marketing does not actually export `foo`
// The important thing is that typechecking succeeds
}
10 changes: 10 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "commonjs",
"moduleResolution": "node",
"typeRoots": ["./types", "./node_modules/@types"],
"types": ["@mailchimp/mailchimp_marketing"]
},
"include": ["src"]
}
3 changes: 3 additions & 0 deletions types/@mailchimp/mailchimp_marketing/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module "@mailchimp/mailchimp_marketing" {
export const foo: 'bar';
}