mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-09-18 07:00:20 +00:00
[@ember/string] Use type predicate as "isHTMLSafe" result
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } from '@ember/string';
|
||||
import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string';
|
||||
import { SafeString } from 'handlebars';
|
||||
|
||||
dasherize(); // $ExpectError
|
||||
@@ -36,3 +36,11 @@ loc("_Hello %@ %@", ["John", "Smith"]); // $ExpectType string
|
||||
const handlebarsSafeString: SafeString = htmlSafe('lorem ipsum...');
|
||||
htmlSafe('lorem ipsum...'); // $ExpectType SafeString
|
||||
const regularString: string = htmlSafe('lorem ipsum...'); // $ExpectError
|
||||
|
||||
function isSafeTest(a: string|Handlebars.SafeString) {
|
||||
if (isHTMLSafe(a)) {
|
||||
a = a.toString();
|
||||
}
|
||||
|
||||
camelize(a);
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -11,8 +11,8 @@ export function capitalize(str: string): string;
|
||||
export function classify(str: string): string;
|
||||
export function dasherize(str: string): string;
|
||||
export function decamelize(str: string): string;
|
||||
export function htmlSafe(str: string): Handlebars.SafeString;
|
||||
export function isHTMLSafe(str: string): boolean;
|
||||
export function htmlSafe(str: string): SafeString;
|
||||
export function isHTMLSafe(str: any): str is SafeString;
|
||||
export function loc(template: string, args?: string[]): string;
|
||||
export function underscore(str: string): string;
|
||||
export function w(str: string): string[];
|
||||
|
||||
Reference in New Issue
Block a user