mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Add @tinajs/tina (#27191)
- [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). - [x] The package does not already provide its own types, or cannot have its `.d.ts` files generated via `--declaration` - [x] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. - [x] Create it with `dts-gen --dt`, not by basing it on an existing project. - [x] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, `strictNullChecks`, and `strictFunctionTypes` set to `true`.
This commit is contained in:
committed by
Ryan Cavanaugh
parent
47af8e9886
commit
bf441f07a9
@@ -4125,6 +4125,7 @@
|
||||
/types/timelinejs3/ @MikeMatusz
|
||||
/types/timer-machine/ @dolanmiu
|
||||
/types/timezone-js/ @bonnici
|
||||
/types/tinajs__tina/ @Jimexist
|
||||
/types/tinder/ @pingec
|
||||
/types/tiny-slider-react/ @screendriver
|
||||
/types/tinycolor2/ @M-Zuber @geertjansen @nvh
|
||||
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
// Type definitions for @tinajs/tina 1.4
|
||||
// Project: https://github.com/tinajs/tina
|
||||
// Definitions by: Jiayu Liu <https://github.com/Jimexist>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tinajs__tina
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export function use(plugin: any): void;
|
||||
|
||||
export interface ComponentProperties {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface ComponentLifecycles {
|
||||
created: () => void;
|
||||
attached: () => void;
|
||||
ready: () => void;
|
||||
moved: () => void;
|
||||
detached: () => void;
|
||||
}
|
||||
|
||||
export interface ComponentDefinitions extends ComponentLifecycles {
|
||||
properties: ComponentProperties;
|
||||
data: { [key: string]: any };
|
||||
compute: (data: { [key: string]: any }) => { [key: string]: any };
|
||||
methods: { [name: string]: (this: Component) => any };
|
||||
mixins: Array<Partial<ComponentDefinitions>>;
|
||||
}
|
||||
|
||||
export class Component {
|
||||
static define(definitions: Partial<ComponentDefinitions>): void;
|
||||
static mixin(definitions: Partial<ComponentDefinitions>): void;
|
||||
setData(data: { [key: string]: any }): void;
|
||||
data: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface PageHooks {
|
||||
beforeLoad: (this: Page) => void;
|
||||
onLoad: (this: Page) => void;
|
||||
onReady: (this: Page) => void;
|
||||
onShow: (this: Page) => void;
|
||||
onHide: (this: Page) => void;
|
||||
onUnload: (this: Page) => void;
|
||||
}
|
||||
|
||||
export interface PageEvents {
|
||||
onPullDownRefresh: (event: Page) => void;
|
||||
onReachBottom: (event: Page) => void;
|
||||
onShareAppMessage: (event: Page) => void;
|
||||
onPageScroll: (event: Page) => void;
|
||||
}
|
||||
|
||||
export interface PageDefinitions
|
||||
extends ComponentDefinitions,
|
||||
PageEvents,
|
||||
PageHooks {
|
||||
mixins: Array<Partial<PageDefinitions>>;
|
||||
}
|
||||
|
||||
export class Page extends Component {
|
||||
static define(definitions: Partial<PageDefinitions>): void;
|
||||
static mixin(definitions: Partial<PageDefinitions>): void;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { Page, Component } from "@tinajs/tina";
|
||||
|
||||
function sayHi() {
|
||||
return "hi";
|
||||
}
|
||||
|
||||
Page.mixin({
|
||||
onLoad: sayHi,
|
||||
created: sayHi
|
||||
});
|
||||
|
||||
Component.mixin({
|
||||
created: sayHi
|
||||
});
|
||||
|
||||
Page.define({
|
||||
properties: {
|
||||
content: String
|
||||
}
|
||||
});
|
||||
|
||||
Page.define({
|
||||
mixins: [
|
||||
{
|
||||
methods: {
|
||||
lol() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
methods: {
|
||||
tiktok() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
data: {
|
||||
count: 0
|
||||
},
|
||||
compute({ count }) {
|
||||
return { countPlus1: count + 1 };
|
||||
},
|
||||
onLoad() {
|
||||
this.data.count;
|
||||
},
|
||||
methods: {
|
||||
handleTapButton() {
|
||||
this.data.count;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Component.define({
|
||||
data: {}
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@tinajs/tina": ["tinajs__tina"]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "tinajs__tina-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user