Skip to content

Commit

Permalink
Remove unecessary any and add missing typing info (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
llgcode committed Jan 22, 2022
1 parent 2570d3d commit ba47af3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/LaunchPad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LaunchPad {
public static numDrumPads = 64;

// Some State.
public state: any = {
public state = {
orientation: Orientation.Mix,
quantizeGrid: "1/16",
fixedLength: "play_recorded",
Expand Down Expand Up @@ -137,7 +137,7 @@ class LaunchPad {
{
let prefs = host.getPreferences();
ext.prefs.orientation = prefs.getEnumSetting("Orientation", "Grid", PrefOrientation, PrefOrientation[0]);
ext.prefs.orientation.addValueObserver((v: any) => {
ext.prefs.orientation.addValueObserver((v) => {
switch (v) {
case "Mix Only":
this.state.orientation = Orientation.Mix
Expand All @@ -157,12 +157,12 @@ class LaunchPad {
ext.prefs.panOrientation = prefs.getEnumSetting("Pan Faders", "Grid", PrefPanFader, PrefPanFader[0]);

ext.prefs.scenesIndication = prefs.getBooleanSetting("Scenes", "Indicators", false);
ext.prefs.scenesIndication.addValueObserver((v: any) => {
ext.prefs.scenesIndication.addValueObserver((v) => {
ext.sceneBank.setIndication(v);
});

ext.prefs.slotsIndication = prefs.getBooleanSetting("Slots", "Indicators", false);
ext.prefs.slotsIndication.addValueObserver((v: any) => {
ext.prefs.slotsIndication.addValueObserver((v) => {
for (let trackIdx = 0; trackIdx < LaunchPad.numTracks; trackIdx++) {
ext.trackBank.getItemAt(trackIdx).clipLauncherSlotBank().setIndication(v);
}
Expand Down
15 changes: 13 additions & 2 deletions src/Launchpad-Pro-Mk3-for-Bitwig.control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,18 @@ const Layers = {
StopClip: new StopClipLayer(),
}

// @ts-expect-error
type SettableValue = com.bitwig.extension.controller.api.SettableBeatTimeValue
| com.bitwig.extension.controller.api.SettableBooleanValue
| com.bitwig.extension.controller.api.SettableColorValue
| com.bitwig.extension.controller.api.SettableDoubleValue
| com.bitwig.extension.controller.api.SettableEnumValue
| com.bitwig.extension.controller.api.SettableIntegerValue
| com.bitwig.extension.controller.api.SettableRangedValue
| com.bitwig.extension.controller.api.SettableStringArrayValue
| com.bitwig.extension.controller.api.SettableStringValue
;

// @ts-ignore
const ext: {
// Bitwig API
app: API.Application;
Expand All @@ -90,7 +101,7 @@ const ext: {
cursorTrackFirstDevice: API.PinnableCursorDevice;
cursorRemote: API.CursorRemoteControlsPage;
cursorDrumPadBank: API.DrumPadBank;
prefs: any;
prefs: Record<string, SettableValue>;
// Our API
grid: Grid;
buttons: Buttons;
Expand Down
8 changes: 5 additions & 3 deletions src/Layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class Layer {

public static orientation: Orientation = Orientation.Mix;

private static canScroll: any = {
private static canScroll = {
tracksUp: false,
tracksDown: false,
scenesUp: false,
Expand Down Expand Up @@ -312,11 +312,11 @@ class Layer {
Layer.getCurrent().updateScrolling();
}

public static getScroll(dir: string) {
public static getScroll(dir: ScrollDir) {
return Layer.canScroll[dir];
}

public static setScroll(dir: string, canScroll: boolean) {
public static setScroll(dir: ScrollDir, canScroll: boolean) {
Layer.canScroll[dir] = canScroll;
Layer.getCurrent().updateScrolling();
}
Expand Down Expand Up @@ -349,3 +349,5 @@ class Layer {
}

}

type ScrollDir = keyof typeof Layer["canScroll"];

0 comments on commit ba47af3

Please sign in to comment.