From 2e308ffc62c53c5ddf2e22f56fac03fa68205a6d Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 16 Feb 2019 22:00:42 +0800 Subject: [PATCH] [improvement] Loading: tsx (#2765) --- packages/loading/{index.js => index.tsx} | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) rename packages/loading/{index.js => index.tsx} (77%) diff --git a/packages/loading/index.js b/packages/loading/index.tsx similarity index 77% rename from packages/loading/index.js rename to packages/loading/index.tsx index a7772857b..7440a5690 100644 --- a/packages/loading/index.js +++ b/packages/loading/index.tsx @@ -1,10 +1,18 @@ import { use } from '../utils'; import { inherit } from '../utils/functional'; +// Types +import { FunctionalComponent } from '../utils/use/sfc'; + const [sfc, bem] = use('loading'); const DEFAULT_COLOR = '#c9c9c9'; -function Loading(h, props, slots, ctx) { +const Loading: FunctionalComponent = function( + h, + props, + slots, + ctx +) { const { color, size, type } = props; const colorType = color === 'white' || color === 'black' ? color : ''; @@ -36,7 +44,7 @@ function Loading(h, props, slots, ctx) { ); -} +}; Loading.props = { size: String, @@ -50,4 +58,10 @@ Loading.props = { } }; -export default sfc(Loading); +export type LoadingProps = { + size?: string; + type?: string; + color?: string; +}; + +export default sfc(Loading);