Closed danechitoaie closed 3 years ago
TOML.parse
does not support argumentType, please use as
(which is the actual behaviour for a parser program -- it does not know the source, and can not help you to make type checking):
TOML.parse(tomlSource, {
joiner: "\n",
bigint: false,
}) as { a :string, b :string };
If you need a real type check, you may need an asserts function:
const root = TOML.parse(tomlSource, {
joiner: "\n",
bigint: false,
});
function assertsABString (value :{ [name :string] :unknown }) :asserts value is { a :string, b :string } {
if ( typeof value.a!=='string' ) { throw TypeError('...'); }
if ( typeof value.b!=='string' ) { throw TypeError('...'); }
}
assertsABString(root);
I'm trying to use the following code:
but this give the following error:
So it asks me to define
x: TagProcessor<{ a: string; b: string; }>
. What is this?Thanks.