Skip to content

Commit

Permalink
chore: add exemptions for type-coverage
Browse files Browse the repository at this point in the history
- In these cases we know what the source data is so it is OK for now but in the future we should add
some proper validation

re #90
  • Loading branch information
Sean Dawson committed Aug 5, 2020
1 parent 096451b commit c68505c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/app/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const updateButtonState = async () => {

browser.runtime.onMessage.addListener(
async (rawMessage: unknown, sender: Runtime.MessageSender) => {
// type-coverage:ignore-next-line
const message = rawMessage as Message;
if (sender.tab === undefined) {
return;
Expand Down
1 change: 1 addition & 0 deletions src/app/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const init = (bitbucketServerScmModule: ScmModule) => {

browser.runtime.onMessage.addListener(
async (rawMessage: unknown, sender: Runtime.MessageSender) => {
// type-coverage:ignore-next-line
const message = rawMessage as Message;
console.log(
`[Mule Preview] Received message from [${sender}]: [${JSON.stringify(
Expand Down
6 changes: 4 additions & 2 deletions src/app/scms/bitbucket-server/scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import { MessageType } from "~app/types/messenging";
// browser so it should be free of dependencies and small as possible
(() => {
const isPullRequest = (
pageState: unknown
pageState: CommonPageState
): pageState is PullRequestPageState => {
// type-coverage:ignore-next-line
const prPageState = pageState as PullRequestPageState;
return (
prPageState.getPullRequest !== undefined &&
prPageState.getPullRequest() !== undefined
);
};

const isDiff = (pageState: unknown): pageState is DiffPageState => {
const isDiff = (pageState: CommonPageState): pageState is DiffPageState => {
// type-coverage:ignore-next-line
const diffPageState = pageState as DiffPageState;
return (
diffPageState.getSourceRepository !== undefined &&
Expand Down
6 changes: 4 additions & 2 deletions src/app/scms/bitbucket-server/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ export const getCurrentFile = () => {

export const getBitbucketData = async (): Promise<ScraperResponse> => {
return new Promise((resolve, reject) => {
// TODO: Work out why there is a force cast to EventListener here
// type-coverage:ignore-next-line
document.addEventListener("BitbucketDataScraped", ((
event: CustomEvent<ScraperResponse>
) => {
console.log(`Recieved ["BitbucketDataScraped"] event!`);
console.log(`Received ["BitbucketDataScraped"] event!`);
resolve(event.detail);
}) as EventListener);
}) as EventListener);
setTimeout(
() => reject(new Error("Took too long to scrape Bitbucket data")),
1000
Expand Down

0 comments on commit c68505c

Please sign in to comment.