From 2aae1a4b07b3edc549d7e144e48b360f996f69b4 Mon Sep 17 00:00:00 2001 From: Ajit Date: Sat, 31 Dec 2022 14:35:12 +0530 Subject: [PATCH] docs: mention usage with typescript --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 285a90b..2136438 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,18 @@ Use the `.toTitleCase()` method on strings you want converted to title case: The script assumes input is either sentence case (e.g. _To title case for JavaScript_) or every-word “title case” (e.g. _To Title Case For JavaScript_). In both cases, the script will convert the text to _To Title Case for JavaScript_. +### Get TypeScript typings + +Create a file `string.d.ts` at the root of your project with the following content: + +```ts +declare interface String { + toTitleCase(): string; +} +``` + +The name of the file does not matter, but it needs to have `.d.ts` in its end. + ## What is Title Case? Title case (or headline case) is a convention for formatting the titles of things. It’s often used for the title of articles, but also matters if you mention the title of something in paragraph.