Skip to content

Commit

Permalink
enable all strict type checking options
Browse files Browse the repository at this point in the history
  • Loading branch information
kenany committed Dec 1, 2018
1 parent b69a947 commit 2edf757
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
7 changes: 7 additions & 0 deletions assets/chat/js/chat.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare class Chat {
public output: JQuery;
public settings: ReadonlyMap<string, unknown>;
public ui: JQuery;
}

export default Chat;
10 changes: 6 additions & 4 deletions assets/chat/js/focus.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
/* global $ */

import Chat from './chat';

/**
* Handles the dimming of the chat when you click on a username
* within the chat GUI
*/
class ChatUserFocus {
private chat;
private css;
private chat: Chat;
private css: CSSStyleSheet;
private focused: string[];

constructor(chat, css) {
constructor(chat: Chat, css: CSSStyleSheet) {
this.chat = chat;
this.css = css;
this.focused = [];
this.chat.output.on('mousedown', e => this.toggleElement(e.target));
}

toggleElement(target) {
toggleElement<TElement = HTMLElement>(target: TElement) {
const t = $(target);
if(t.hasClass('chat-user')) {
if(!this.chat.settings.get('focusmentioned')) {
Expand Down
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@types/jquery": "^3.3.22",
"autoprefixer": "~8.0.0",
"babel-loader": "^8.0.4",
"clean-webpack-plugin": "~0.1.18",
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"target": "es2017",
"module": "esnext"
"module": "esnext",
"strict": true,
"target": "es2017"
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit 2edf757

Please sign in to comment.