Properly type check codebase with tsc
This commit is contained in:
parent
75c4ff6a80
commit
d6cb49a0d1
1
src/global.d.ts
vendored
Normal file
1
src/global.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
declare module "*.mp3";
|
|
@ -28,3 +28,5 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export {};
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { Provider } from "react-redux";
|
||||||
import { store } from "./store";
|
import { store } from "./store";
|
||||||
import MusicPlayer from "./MusicPlayer";
|
import MusicPlayer from "./MusicPlayer";
|
||||||
import { setSource, setTitle } from "./store/music/types";
|
import { setSource, setTitle } from "./store/music/types";
|
||||||
// @ts-ignore - mp3 files have no types.
|
|
||||||
import mseq from "./Mseq_-_Journey.mp3";
|
import mseq from "./Mseq_-_Journey.mp3";
|
||||||
|
|
||||||
const rootElement = document.getElementById("playerUI");
|
const rootElement = document.getElementById("playerUI");
|
||||||
|
|
|
@ -26,17 +26,25 @@ const initialState: MusicState = {
|
||||||
|
|
||||||
export const musicStateReducer = createReducer<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 => {
|
[setTitle]: (state: MusicState, title: Title): MusicState => {
|
||||||
return update(state, {
|
return update(state, {
|
||||||
title: { $set: title },
|
title: { $set: title },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// @ts-ignore - These appear to be working, even if functions
|
||||||
|
// are technically prohibited, and were recommended upstream
|
||||||
[togglePlay]: (state: MusicState): MusicState => {
|
[togglePlay]: (state: MusicState): MusicState => {
|
||||||
return update(state, { $toggle: ["playing"] });
|
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 => {
|
[toggleMute]: (state: MusicState): MusicState => {
|
||||||
return update(state, { $toggle: ["muted"] });
|
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 => {
|
[setSource]: (state: MusicState, source: string): MusicState => {
|
||||||
return update(state, { source: { $set: source } });
|
return update(state, { source: { $set: source } });
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue