Skip to content

Commit

Permalink
Merge pull request #146 from NI57721/refactor/typeof
Browse files Browse the repository at this point in the history
refactor: use functions of unknownutil within conditions instead of typeof
  • Loading branch information
Shougo authored Aug 20, 2023
2 parents 4d42d04 + 85c9d1d commit a9fa215
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion denops/skkeleton/kana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getKanaTable(name = currentKanaTable.get()): KanaTable {
}

function asKanaResult(result: unknown): KanaResult {
if (typeof result === "string") {
if (is.String(result)) {
const fn = functions.get()[result];
if (!fn) {
throw Error(`function not found: ${result}`);
Expand Down
4 changes: 2 additions & 2 deletions denops/skkeleton/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type HandleResult = {

// deno-lint-ignore no-explicit-any
function isOpts(x: any): x is Opts {
return typeof x?.key === "string";
return is.String(x?.key);
}

function assertOpts(x: unknown): asserts x is Opts {
Expand Down Expand Up @@ -92,7 +92,7 @@ async function init(denops: Denops) {
.map(async (
cfg,
): Promise<[string, string]> => {
if (typeof cfg === "string") {
if (is.String(cfg)) {
return [await homeExpand(cfg, denops), ""];
} else {
return [await homeExpand(cfg[0], denops), cfg[1]];
Expand Down

0 comments on commit a9fa215

Please sign in to comment.