mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
22 lines
527 B
TypeScript
22 lines
527 B
TypeScript
import replaceString = require('replace-string');
|
|
|
|
const input = 'My friend has a 🐑. I want a 🐑 too!';
|
|
|
|
// $ExpectType string
|
|
replaceString(input, '🐑', '🦄');
|
|
// $ExpectType string
|
|
replaceString(input, '🐑', (needle, matchCount, input, matchIndex) => {
|
|
// $ExpectType string
|
|
needle;
|
|
// $ExpectType number
|
|
matchCount;
|
|
// $ExpectType string
|
|
input;
|
|
// $ExpectType number
|
|
matchIndex;
|
|
|
|
return '🦄';
|
|
});
|
|
// $ExpectType string
|
|
replaceString(input, '🐑', '🦄', { fromIndex: 1 });
|