DefinitelyTyped/types/string-placeholder/string-placeholder-tests.ts
Filipe Ferreira c31e519f1b Added typing for string-placeholder (#40373)
* Added typing for string-placeholder

* Fixed linting

* Added readonly to arrays

* Change typescript version

* Fixed types definition

* Code review comments

* Removed clean as array type

* Fix export

* Fix export
2019-11-19 15:54:45 -08:00

20 lines
472 B
TypeScript

import template from 'string-placeholder';
// $ExpectType string
template('${0} test', ['here']);
// $ExpectType string
template('${foo} test ${bar}', {foo: 'Bob', bar: '65'});
// $ExpectType string
template('${0} test', ['here'], { after: '[:' });
// $ExpectType string
template('${0} test', ['here'], { before: ']' });
// $ExpectType string
template('${0} test', ['here'], { escape: '\\' });
// $ExpectType string
template('${0} test', ['here'], { clean: true });