Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
Update typing for sending message
Browse files Browse the repository at this point in the history
  • Loading branch information
xnkevinnguyen committed Feb 10, 2020
1 parent 84fd761 commit 4e8e95e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
6 changes: 1 addition & 5 deletions src/view/components/microbit/MicrobitImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ interface IProps {
eventTriggers: EventTriggers;
leds: number[][];
}
interface IState {
microbitImageRef: React.RefObject<SVGSVGElement>;
buttonRefs: { [key: string]: React.RefObject<SVGRectElement> };
}

// Displays the SVG and call necessary svg modification.
export class MicrobitImage extends React.Component<IProps, IState> {
export class MicrobitImage extends React.Component<IProps, {}> {
private svgRef: React.RefObject<MicrobitSvg> = React.createRef();
constructor(props: IProps) {
super(props);
Expand Down
5 changes: 4 additions & 1 deletion src/view/utils/MessageUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ interface vscode {

declare const vscode: vscode;

export const sendMessage = (type: string, state: any) => {
export const sendMessage = <TState extends unknown>(
type: string,
state: TState
) => {
vscode.postMessage({ command: type, text: state });
};
62 changes: 32 additions & 30 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
{
"rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
"extends": [
"tslint:latest",
"tslint-react",
"tslint-config-prettier",
"tslint-react-hooks",
"tslint-microsoft-contrib/latest"
],
"rules": {
"no-implicit-dependencies": [true, "dev"],
"no-string-throw": true,
"no-unused-expression": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-relative-imports": false,
"max-func-body-length": false,
"curly": true,
"class-name": true,
"triple-equals": true,
"object-literal-sort-keys": true,
"react-hooks-nesting": "error",
"ordered-imports": true,
"import-name": false,
"member-access": false,
"no-console": false,
"jsx-boolean-value": false,
"no-unnecessary-semicolons": false,
"no-http-string": false
},
"defaultSeverity": "warning"
"rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
"extends": [
"tslint:latest",
"tslint-react",
"tslint-config-prettier",
"tslint-react-hooks",
"tslint-microsoft-contrib/latest"
],
"rules": {
"no-implicit-dependencies": [true, "dev"],
"no-string-throw": true,
"no-unused-expression": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-relative-imports": false,
"max-func-body-length": false,
"curly": true,
"class-name": true,
"triple-equals": true,
"object-literal-sort-keys": true,
"react-hooks-nesting": "error",
"ordered-imports": true,
"import-name": false,
"member-access": false,
"no-console": false,
"jsx-boolean-value": false,
"no-unnecessary-semicolons": false,
"no-http-string": false,
"export-name": false,
"interface-name": false
},
"defaultSeverity": "warning"
}

0 comments on commit 4e8e95e

Please sign in to comment.