From cedf7c12a8cc6c715a456c0a08dea4b0d2787b48 Mon Sep 17 00:00:00 2001 From: Christoph Zauner Date: Mon, 2 Sep 2019 12:15:25 +0200 Subject: [PATCH] Add type definitions for TypeScript. --- index.d.ts | 22 ++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..1def635 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,22 @@ +import * as React from "react"; + +export interface Match { + index: number; + lastIndex: number; + text: string; + url: string; +} + +export interface LinkifyProps { + children: React.ReactNode; + componentDecorator?: ( + decoratedHref: string, + decoratedText: string, + key: number + ) => React.ReactNode; + hrefDecorator?: (text: string) => string; + matchDecorator?: (text: string) => Match[]; + textDecorator?: (text: string) => string; +} + +export default class Linkify extends React.Component {} diff --git a/package.json b/package.json index 6b83a4c..10bc0b5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "author": "Tasti Zakarie", "license": "MIT", "main": "dist/index.js", - "files": ["dist"], + "types": "index.d.ts", + "files": ["dist", "index.d.ts"], "repository": { "type": "git", "url": "https://github.com/tasti/react-linkify.git"