This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private Type WindowData | |
pfnBase As LongPtr | |
End Type | |
Private Const WindowDataPropName As String = "InputBoxWndData" | |
Private Const WH_CBT As Long = 5 | |
Private Const HCBT_CREATEWND As Long = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 「typeof 演算子」の型を取得するためのダミー関数 | |
function _dummy() { return typeof ''; } | |
type TypeofType = ReturnType<typeof _dummy>; | |
// 「TypeofType」は TS 4.9 時点では「'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function'」になる | |
// typeof 演算子の結果の文字列に対応する型を書いたマップオブジェクト | |
interface TypeofTypeMap { | |
number: number; | |
string: string; | |
boolean: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for license: see https://gist.github.com/jet2jet/93fab0cbd08e89bf47f81835a2dfe46c | |
// *** Must be used with TS 4.8 or later *** | |
type NumericChars = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'; | |
interface DigitToTuple { | |
'0': []; | |
'1': ['']; | |
'2': ['', '']; | |
'3': ['', '', '']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for license: see https://gist.github.com/jet2jet/93fab0cbd08e89bf47f81835a2dfe46c | |
type NumericChars = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'; | |
type TupleLength<T extends any[]> = | |
any[] extends T ? never : T['length']; | |
// from microsoft/TypeScript#40336 | |
type Split<S extends string, D extends string> = | |
string extends S ? string[] : | |
S extends '' ? [] : | |
S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type _Cast<T, U> = T extends U ? T : U; | |
type Spaces1 = ' ' | '\r' | '\n'; | |
type Spaces2 = `${Spaces1}${Spaces1}`; | |
type Spaces3 = `${Spaces2}${Spaces1}`; | |
type Spaces4 = `${Spaces3}${Spaces1}`; | |
type Trim<T> = | |
_Cast<T, string> extends `${Spaces1} ${infer Rest}` ? Trim<Rest> : | |
_Cast<T, string> extends `${Spaces1} ${infer Rest}` ? Trim<Rest> : | |
_Cast<T, string> extends `${Spaces1} ${infer Rest}` ? Trim<Rest> : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (C) jet2jet (jet / ジェット) | |
Permission to use, copy, modify, and/or distribute this software for any | |
purpose with or without fee is hereby granted. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | |
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |