-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
bugSomething isn't working correctlySomething isn't working correctlytypesIssues related to TypeScript typesIssues related to TypeScript types
Description
Version: Deno 1.44.2
The isWellFormed() method on strings works, but doesn't type-check.
% cat >> bug.ts
"".isWellFormed()
% deno check bug.ts
Check [redacted]/bug.ts
error: TS2339 [ERROR]: Property 'isWellFormed' does not exist on type '""'.
"".isWellFormed()
~~~~~~~~~~~~
at [redacted]/bug.ts:1:4
% deno
Deno 1.44.2
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> "".isWellFormed()
true
>
Here is a workaround:
interface ExtraStringMethods {
isWellFormed(): boolean;
}
function isWellFormed(str: string): boolean {
return (str as unknown as ExtraStringMethods).isWellFormed();
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't working correctlySomething isn't working correctlytypesIssues related to TypeScript typesIssues related to TypeScript types