Properly type check codebase with tsc

This commit is contained in:
Tristan Daniël Maat 2022-08-01 22:07:15 +01:00
parent 75c4ff6a80
commit d6cb49a0d1
Signed by: tlater
GPG key ID: 49670FD774E43268
5 changed files with 11 additions and 1 deletions

1
src/global.d.ts vendored Normal file
View file

@ -0,0 +1 @@
declare module "*.mp3";

View file

@ -28,3 +28,5 @@ document.addEventListener("DOMContentLoaded", () => {
});
});
});
export {};

View file

@ -5,7 +5,6 @@ import { Provider } from "react-redux";
import { store } from "./store";
import MusicPlayer from "./MusicPlayer";
import { setSource, setTitle } from "./store/music/types";
// @ts-ignore - mp3 files have no types.
import mseq from "./Mseq_-_Journey.mp3";
const rootElement = document.getElementById("playerUI");

View file

@ -26,17 +26,25 @@ const initialState: MusicState = {
export const musicStateReducer = createReducer<MusicState>(
{
// @ts-ignore - These appear to be working, even if functions
// are technically prohibited, and were recommended upstream
[setTitle]: (state: MusicState, title: Title): MusicState => {
return update(state, {
title: { $set: title },
});
},
// @ts-ignore - These appear to be working, even if functions
// are technically prohibited, and were recommended upstream
[togglePlay]: (state: MusicState): MusicState => {
return update(state, { $toggle: ["playing"] });
},
// @ts-ignore - These appear to be working, even if functions
// are technically prohibited, and were recommended upstream
[toggleMute]: (state: MusicState): MusicState => {
return update(state, { $toggle: ["muted"] });
},
// @ts-ignore - These appear to be working, even if functions
// are technically prohibited, and were recommended upstream
[setSource]: (state: MusicState, source: string): MusicState => {
return update(state, { source: { $set: source } });
},