forked from slackapi/node-slack-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exports method argument types, fixes slackapi#483
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { WebClient, ChatPostMessageArguments } from '../../../dist'; | ||
|
||
const web = new WebClient('TOKEN'); | ||
|
||
// calling a method directly with arbitrary arguments should work | ||
web.chat.postMessage({ | ||
channel: 'CHANNEL', | ||
text: 'TEXT', | ||
key: 'VALUE', | ||
}); | ||
|
||
// calling a method directly with underspecified arguments should not work | ||
// typings:expect-error | ||
web.chat.postMessage({ | ||
channel: 'CHANNEL', | ||
}); | ||
|
||
// assigning an object with a specific type that includes arbitrary arguments should not work | ||
const message: ChatPostMessageArguments = { | ||
text: 'TEXT', | ||
channel: 'CHANNEL', | ||
// typings:expect-error | ||
key: 'VALUE', | ||
}; | ||
|
||
// this is just here to avoid the following error: | ||
// 'message' is declared but its value is never read. | ||
console.log(message); |
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