Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary "any" type and add missing typing info #4

Merged
merged 1 commit into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"];