Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add TS typings #27

Merged
merged 3 commits into from Aug 13, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -11,6 +11,7 @@
"unpkg": "dist/vue-slim-tabs.js",
"jsdelivr": "dist/vue-slim-tabs.js",
"cdn": "dist/vue-slim-tabs.js",
"types": "types/vue-slim-tabs.d.ts",
"poi": {
"entry": "example/index.js",
"output": {
@@ -19,7 +20,8 @@
},
"files": [
"dist",
"themes"
"themes",
"types"
],
"scripts": {
"test": "echo 'no tests!' && npm run lint",
@@ -0,0 +1,34 @@
import { PluginFunction, VueConstructor } from 'vue';

export const Tabs: TabsConstructor;
export const Tab: TabConstructor;
export const install: PluginFunction<{}>;

export interface TabsProps {
defaultIndex: number;
onSelect: (val: any) => void;
}

export interface TabsData {
selectedIndex: number;
}

export interface TabsMethods {
switchTable: (e: Event, index: number, isDisabled: boolean) => void;
This conversation was marked as resolved by t-cst

This comment has been minimized.

Copy link
@saltysugar

saltysugar Aug 9, 2019

Suggested change
switchTable: (e: Event, index: number, isDisabled: boolean) => void;
switchTab: (e: Event, index: number, isDisabled: boolean) => void;
}

export interface TabProps {
title: string;
titleSlot: string;
disabled: boolean;
}
This conversation was marked as resolved by egoist

This comment has been minimized.

Copy link
@egoist

egoist Aug 9, 2019

Owner

Some props are optional

This comment has been minimized.

Copy link
@t-cst

t-cst Aug 9, 2019

Author Contributor

Checking the implementation, it seems that actuality all TabsProps and TabProps are optional. I've updated the typings.


export interface TabsConstructor extends VueConstructor {
props: TabsProps;
data: () => TabsData;
methods: TabsMethods;
}

export interface TabConstructor extends VueConstructor {
props: TabProps;
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.