diff --git a/demo/type-test.tsx b/demo/type-test.tsx
new file mode 100644
index 0000000..3afbab0
--- /dev/null
+++ b/demo/type-test.tsx
@@ -0,0 +1,61 @@
+/**
+ * This file contains a very small demo project
+ * that is tested for type correctness in the
+ * `npm run test:type-check` check.
+ *
+ * This file is intended to include any API interface
+ * to ensure that our type definitions are correct.
+ */
+
+import React, { Component } from 'react';
+import Avatar, {
+ createAvatarComponent,
+ ConfigProvider,
+ Cache,
+
+ GravatarSource,
+ FacebookSource,
+ GithubSource,
+ SkypeSource,
+ ValueSource,
+ SrcSource,
+ IconSource,
+
+ VKontakteSource,
+ InstagramSource,
+ TwitterSource,
+ GoogleSource,
+} from '..';
+
+const CustomAvatar = createAvatarComponent({
+ sources: [
+ GravatarSource,
+ FacebookSource,
+ GithubSource,
+ SkypeSource,
+ ValueSource,
+ SrcSource,
+ IconSource,
+ VKontakteSource,
+ InstagramSource,
+ TwitterSource,
+ GoogleSource,
+ ]
+});
+
+export default
+class TypeTest extends Component {
+
+ render() {
+ return (
+
+ )
+ }
+}
diff --git a/index.d.ts b/index.d.ts
index 1641ca2..275c86c 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -157,14 +157,14 @@ interface Source {
type SourceConstructor = new (props: object) => Source;
-const AvatarRedirectSource: SourceConstructor;
-export const RedirectSource: (network: string, property: string) => AvatarRedirectSource
+export const RedirectSource: (network: string, property: string) => SourceConstructor
/**
* Universal avatar makes it possible to fetch/generate an avatar based on the information you have about that user.
* We use a fallback system that if for example an invalid Facebook ID is used it will try Google, and so on.
*/
-declare const ReactAvatar: React.ComponentType;
+type ReactAvatar = React.ComponentType;
+declare const Avatar : ReactAvatar;
export const createAvatarComponent: (options: CreateAvatarOptions) => ReactAvatar;
@@ -184,4 +184,4 @@ export const InstagramSource: SourceConstructor;
export const TwitterSource: SourceConstructor;
export const GoogleSource: SourceConstructor;
-export default ReactAvatar;
+export default Avatar;
diff --git a/package.json b/package.json
index 4705422..8383611 100644
--- a/package.json
+++ b/package.json
@@ -17,9 +17,9 @@
"demo": "npm -s run build:demo",
"dev": "webpack-dev-server",
"serve": "npm -s run dev",
- "test": "npm -s run test:lint && npm -s run test:tslint",
+ "test": "npm -s run test:lint && npm -s run test:type-check",
"test:lint": "eslint src",
- "test:tslint": "tslint ./index.d.ts",
+ "test:type-check": "tsc -p tsconfig.json",
"postpublish": "npm -s run publish:docs",
"publish:docs": "npm -s run build:demo && gh-pages -d build"
},
@@ -59,8 +59,7 @@
"gh-pages": "^2.1.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
- "tslint": "^6.1.2",
- "typescript": "^3.8.3",
+ "typescript": "^3.9.3",
"webpack": "^4.41.4",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-cli": "^3.3.10",
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..29aeb9f
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "compilerOptions": {
+ "target": "es6",
+ "module": "commonjs",
+ "jsx": "react",
+ "noEmit": true,
+ "strict": true,
+ "esModuleInterop": true,
+ "forceConsistentCasingInFileNames": true
+ }
+}
diff --git a/tslint.json b/tslint.json
deleted file mode 100644
index 32fa6e5..0000000
--- a/tslint.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "defaultSeverity": "error",
- "extends": [
- "tslint:recommended"
- ],
- "jsRules": {},
- "rules": {},
- "rulesDirectory": []
-}
\ No newline at end of file