mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-12 03:45:34 +00:00
chore(web): noImplicitReturns, strictNullChecks
This commit is contained in:
parent
35b7ed647f
commit
3530314cbd
9 changed files with 22 additions and 11 deletions
|
|
@ -178,7 +178,7 @@ export class GestureMatcher<Type, StateToken = any> implements PredecessorMatch<
|
|||
return this._isCancelled;
|
||||
}
|
||||
|
||||
private finalize(matched: boolean, cause: FulfillmentCause) {
|
||||
private finalize(matched: boolean, cause: FulfillmentCause): MatchResult<Type> {
|
||||
if(this.publishedPromise.isFulfilled) {
|
||||
return this._result;
|
||||
}
|
||||
|
|
@ -242,6 +242,13 @@ export class GestureMatcher<Type, StateToken = any> implements PredecessorMatch<
|
|||
/* c8 ignore next 3 */
|
||||
} catch(err) {
|
||||
this.publishedPromise.reject(err);
|
||||
return {
|
||||
matched: false,
|
||||
action: {
|
||||
type: 'none',
|
||||
item: null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,6 +227,8 @@ export class TouchEventEngine<ItemType, StateToken = any> extends InputEventEngi
|
|||
this.inputStartSignalMap.set(touchpoint, eventSignalPromise);
|
||||
|
||||
return eventSignalPromise.corePromise;
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ export default class LanguageProcessor extends EventEmitter<LanguageProcessorEve
|
|||
} else if(outputTarget) {
|
||||
let transcription = outputTarget.buildTranscriptionFrom(outputTarget, null, false);
|
||||
return this.predict_internal(transcription, true, layerId);
|
||||
} else {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +286,6 @@ export default class LanguageProcessor extends EventEmitter<LanguageProcessorEve
|
|||
let original = this.getPredictionState(-reversion.transformId);
|
||||
if(!original) {
|
||||
console.warn("Could not apply the Suggestion!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply the Reversion!
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ export default class PredictionContext extends EventEmitter<PredictionContextEve
|
|||
this.suggestionApplier = (suggestion) => {
|
||||
if(validSuggestionState()) {
|
||||
return langProcessor.applySuggestion(suggestion, this.currentTarget, () => kbdProcessor.layerId);
|
||||
} else {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +245,7 @@ export default class PredictionContext extends EventEmitter<PredictionContextEve
|
|||
* Should return 'false' if the current state allows reverting a recently-applied suggestion and act accordingly.
|
||||
* Otherwise, return true.
|
||||
*/
|
||||
private doTryRevert = (/*returnObj: {shouldSwallow: boolean}*/): boolean => {
|
||||
private doTryRevert = (/*returnObj: {shouldSwallow: boolean}*/): void => {
|
||||
// Has the revert keystroke (BKSP) already been sent once since the last accept?
|
||||
if(this.doRevert) {
|
||||
// If so, clear the 'revert' option and start doing normal predictions again.
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ export default class KeyboardProcessor extends EventEmitter<EventMap> {
|
|||
|
||||
// Do not change layer unless needed (27/08/2015)
|
||||
if(id == activeLayer && keyEvent.device.formFactor != DeviceSpec.FormFactor.Desktop) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
var idx=id;
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ export class ContextTracker extends CircularArray<TrackedContextState> {
|
|||
There's already an implied whitespace to the left, so we conceptually
|
||||
merge the new whitespace with that one.
|
||||
*/
|
||||
return state;
|
||||
return;
|
||||
} else if(isBackspace) {
|
||||
// Consider backspace entry for this case?
|
||||
state.replaceTailForBackspace(finalToken, primaryInput.id);
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ export abstract class RecordedKeystroke {
|
|||
return new RecordedPhysicalKeystroke(obj as RecordedPhysicalKeystroke);
|
||||
} else if(obj.type == "osk") {
|
||||
return new RecordedSyntheticKeystroke(obj as RecordedSyntheticKeystroke);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
// TODO: These override ../tsconfig.base.json settings, and so should be removed if possible,
|
||||
// but existing code in web/ breaks some of these settings
|
||||
"noImplicitAny": false,
|
||||
"strictFunctionTypes": false
|
||||
"strictFunctionTypes": false,
|
||||
"noImplicitReturns": false,
|
||||
"strictNullChecks": false,
|
||||
}
|
||||
}
|
||||
|
|
@ -10,11 +10,6 @@
|
|||
"lib": ["es6"],
|
||||
"target": "es5",
|
||||
|
||||
// TODO: These override ../tsconfig.base.json settings, and so should be removed if possible,
|
||||
// but existing code in web/ breaks some of these settings
|
||||
"noImplicitReturns": false,
|
||||
"strictNullChecks": false,
|
||||
|
||||
// Other settings - declaration files, sourcemapping, and other miscellaneous bits.
|
||||
"allowJs": false,
|
||||
"declaration": true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue