refactor(web): refactor and cleanup `validateForCustomKeyboard` and `KeyboardStub`
- Dominant language
- Pascal
- Stars
- 534
- Forks
- 143
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 113
Description
@mcdurdin wrote in [#16067](https://github.com/keymanapp/keyman/pull/16067#pullrequestreview-4447246900):
> I hate the way this returns an `Error` rather than just a `boolean`. The error message itself undoes the good of having a `super` function because it includes knowledge of what the super function tests! Error message construction does not belong in the validation function IMO, but in the higher level.
>
> What's more, this is called in just one place in keyboardRequisitioner.ts, but we have two functions, one with an `Error` message that is never used, just constructed and then thrown away in the subclass. We could (and should) simplify so many of these abstractions and reduce the complexity of KMW.
>
> Weird: keyboardLoaderBase.ts has:
> ```ts
> export type KeyboardStub = KeyboardProperties & { filename: string };
> ```
>
> but `KeyboardStub` is defined in keyboardStub.ts:
> ```ts
> export class KeyboardStub extends KeyboardProperties
> ```
>
> And we have `RawKeyboardStub` vs `KeyboardStub`:
>
> ```ts
> export interface RawKeyboardStub extends KeyboardStub {};
> ```
>
> I don't understand why all these are necessary!
Contributor guide
Assessment
This issue has not been assessed yet.