absolutely massive typescript porting time

This commit is contained in:
41666 2019-06-02 18:58:15 -05:00
parent 01f238f515
commit 30d08a630f
No known key found for this signature in database
GPG key ID: BC51D07640DC10AF
159 changed files with 2563 additions and 3861 deletions

View file

@ -0,0 +1,14 @@
linters:
lib/*.{js,jsx}:
- standard --fix
- git add
lib/*.d.ts:
- tslint --fix
- git add
src/*.{ts,tsx}:
- tslint --fix
- stylelint --fix
- jest --bail --findRelatedTests
- git add

View file

@ -1,5 +1,4 @@
// @flow
export type Category = {
export declare type Category = {
hidden: boolean,
name: string,
roles: string[],

View file

@ -1,21 +1,21 @@
// @flow
export type {
declare module "@roleypoly/types"
export {
PresentableRole,
CachedRole,
Permissions
} from './role'
export type {
export {
PresentableServer,
ServerModel,
ServerSlug
} from './server'
export type {
export {
Category
} from './category'
export type {
export {
UserPartial,
Member
} from './user'

View file

@ -1,5 +1,13 @@
{
"name": "@roleypoly/types",
"version": "2.0.0",
"private": true
"private": true,
"scripts": {
"precommit": "lint-staged"
},
"devDependencies": {
"lint-staged": "^8.1.7",
"tslint": "^5.17.0",
"typescript": "^3.5.1"
}
}

View file

@ -0,0 +1,2 @@
export declare module 'moniker';

View file

@ -1,6 +1,5 @@
// @flow
export type PresentableRole = {
export declare type PresentableRole = {
id: string,
color: number,
name: string,
@ -8,14 +7,14 @@ export type PresentableRole = {
safe: boolean
}
export type Permissions = {
export declare type Permissions = {
canManageRoles: boolean,
isAdmin: boolean,
faked?: boolean,
__faked?: Permissions
}
export type CachedRole = {
export declare type CachedRole = {
id: string,
position: number,
color?: number

View file

@ -1,15 +1,14 @@
// @flow
import type { Category } from './category'
import type { PresentableRole, Permissions } from './role'
import { Category } from './category'
import { PresentableRole, Permissions } from './role'
export type ServerSlug = {
export declare type ServerSlug = {
id: string,
name: string,
ownerID: string,
icon: string
}
export type ServerModel = {
export declare type ServerModel = {
id: string,
categories: {
[uuid: string]: Category
@ -17,7 +16,7 @@ export type ServerModel = {
message: string
}
export type PresentableServer = ServerModel & {
export declare type PresentableServer = ServerModel & {
id: string,
gm?: {
color?: number | string,
@ -25,6 +24,6 @@ export type PresentableServer = ServerModel & {
roles: string[]
},
server: ServerSlug,
roles: ?PresentableRole[],
roles?: PresentableRole[],
perms: Permissions
}

21
packages/roleypoly-types/sessions.d.ts vendored Normal file
View file

@ -0,0 +1,21 @@
export declare type BaseSession = {
userId: string,
expiresAt: number
}
export declare type OAuthSession = BaseSession & {
authType: 'oauth',
accessToken: string,
refreshToken: string
}
export declare type DMSession = BaseSession & {
authType: 'dm'
}
export declare type AuthSession = OAuthSession | DMSession
export declare type Session = AuthSession & Partial<{
}>

View file

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}

13
packages/roleypoly-types/user.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
import { Member as ErisMember } from 'eris'
export declare type UserPartial = {
id: string,
username: string,
discriminator: string,
avatar: string
}
export declare type Member = ErisMember & {
color?: number,
__faked?: true
}

View file

@ -1,14 +0,0 @@
// @flow
import type { Member as ErisMember } from 'eris'
export type UserPartial = {
id: string,
username: string,
discriminator: string,
avatar: string
}
export type Member = ErisMember & {
color?: number,
__faked?: true
}