1
0
forked from mirror/misskey

Fix import related TypeScript errors (#9321)

* Add missing @types packages

* Fix TS1272 type only imports

* Fix TS2821 import assertion
This commit is contained in:
Kagami Sascha Rosylight 2022-12-14 00:01:45 +09:00 committed by GitHub
parent f30d54fe88
commit 4b98920f02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 71 additions and 22 deletions

View File

@ -137,8 +137,11 @@
"@types/bcryptjs": "2.4.2",
"@types/bull": "4.10.0",
"@types/cbor": "6.0.0",
"@types/color-convert": "^2.0.0",
"@types/content-disposition": "^0.5.5",
"@types/escape-regexp": "0.0.1",
"@types/fluent-ffmpeg": "2.1.20",
"@types/ioredis": "4.28.10",
"@types/jest": "29.2.4",
"@types/js-yaml": "4.0.5",
"@types/jsdom": "20.0.1",
@ -162,6 +165,7 @@
"@types/sharp": "0.31.0",
"@types/sinonjs__fake-timers": "8.1.2",
"@types/speakeasy": "2.0.7",
"@types/syslog-pro": "^1.0.0",
"@types/tinycolor2": "1.4.3",
"@types/tmp": "0.2.3",
"@types/unzipper": "0.10.5",

View File

@ -4,6 +4,7 @@ import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';
import Logger from '@/logger.js';
import { bindThis } from '@/decorators.js';
import type { KEYWORD } from 'color-convert/conversions';
@Injectable()
export class LoggerService {
@ -15,9 +16,9 @@ export class LoggerService {
) {
if (this.config.syslog) {
this.syslogClient = new SyslogPro.RFC5424({
applacationName: 'Misskey',
applicationName: 'Misskey',
timestamp: true,
encludeStructuredData: true,
includeStructuredData: true,
color: true,
extendedColor: true,
server: {
@ -29,7 +30,7 @@ export class LoggerService {
}
@bindThis
public getLogger(domain: string, color?: string | undefined, store?: boolean) {
public getLogger(domain: string, color?: KEYWORD | undefined, store?: boolean) {
return new Logger(domain, color, store, this.syslogClient);
}
}

View File

@ -4,10 +4,11 @@ import { default as convertColor } from 'color-convert';
import { format as dateFormat } from 'date-fns';
import { bindThis } from '@/decorators.js';
import { envOption } from './env.js';
import type { KEYWORD } from 'color-convert/conversions';
type Context = {
name: string;
color?: string;
color?: KEYWORD;
};
type Level = 'error' | 'success' | 'warning' | 'debug' | 'info';
@ -18,7 +19,7 @@ export default class Logger {
private store: boolean;
private syslogClient: any | null = null;
constructor(context: string, color?: string, store = true, syslogClient = null) {
constructor(context: string, color?: KEYWORD, store = true, syslogClient = null) {
this.context = {
name: context,
color: color,
@ -28,7 +29,7 @@ export default class Logger {
}
@bindThis
public createSubLogger(context: string, color?: string, store = true): Logger {
public createSubLogger(context: string, color?: KEYWORD, store = true): Logger {
const logger = new Logger(context, color, store);
logger.parentLogger = this;
return logger;

View File

@ -1,5 +1,4 @@
import { Inject, Injectable } from '@nestjs/common';
import { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify';
import fastifyAccepts from '@fastify/accepts';
import httpSignature from '@peertube/http-signature';
import { Brackets, In, IsNull, LessThan, Not } from 'typeorm';
@ -19,6 +18,7 @@ import { QueryService } from '@/core/QueryService.js';
import { UtilityService } from '@/core/UtilityService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify';
import type { FindOptionsWhere } from 'typeorm';
const ACTIVITY_JSON = 'application/activity+json; charset=utf-8';

View File

@ -2,7 +2,6 @@ import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Inject, Injectable } from '@nestjs/common';
import { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify';
import fastifyStatic from '@fastify/static';
import rename from 'rename';
import type { Config } from '@/config.js';
@ -20,6 +19,7 @@ import { contentDisposition } from '@/misc/content-disposition.js';
import { FileInfoService } from '@/core/FileInfoService.js';
import { LoggerService } from '@/core/LoggerService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);

View File

@ -2,7 +2,6 @@ import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Inject, Injectable } from '@nestjs/common';
import { FastifyInstance, FastifyPluginOptions, FastifyReply, FastifyRequest } from 'fastify';
import sharp from 'sharp';
import fastifyStatic from '@fastify/static';
import { DI } from '@/di-symbols.js';
@ -18,6 +17,7 @@ import type Logger from '@/logger.js';
import { FileInfoService } from '@/core/FileInfoService.js';
import { LoggerService } from '@/core/LoggerService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyInstance, FastifyPluginOptions, FastifyReply, FastifyRequest } from 'fastify';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);

View File

@ -1,5 +1,4 @@
import { Inject, Injectable } from '@nestjs/common';
import { FastifyInstance, FastifyPluginOptions, FastifyReply, FastifyRequest } from 'fastify';
import { IsNull, MoreThan } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { NotesRepository, UsersRepository } from '@/models/index.js';
@ -9,6 +8,7 @@ import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
import { Cache } from '@/misc/cache.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
const nodeinfo2_1path = '/nodeinfo/2.1';
const nodeinfo2_0path = '/nodeinfo/2.0';

View File

@ -1,5 +1,4 @@
import { Inject, Injectable } from '@nestjs/common';
import { FastifyInstance, FastifyPluginOptions, FastifyReply, FastifyRequest } from 'fastify';
import { IsNull, MoreThan } from 'typeorm';
import vary from 'vary';
import { DI } from '@/di-symbols.js';
@ -11,6 +10,7 @@ import * as Acct from '@/misc/acct.js';
import { NodeinfoServerService } from './NodeinfoServerService.js';
import type { FindOptionsWhere } from 'typeorm';
import { bindThis } from '@/decorators.js';
import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
@Injectable()
export class WellKnownServerService {

View File

@ -3,7 +3,6 @@ import { pipeline } from 'node:stream';
import * as fs from 'node:fs';
import { promisify } from 'node:util';
import { Inject, Injectable } from '@nestjs/common';
import { FastifyRequest, FastifyReply } from 'fastify';
import { DI } from '@/di-symbols.js';
import { getIpHash } from '@/misc/get-ip-hash.js';
import type { CacheableLocalUser, ILocalUser, User } from '@/models/entities/User.js';
@ -17,6 +16,7 @@ import { ApiError } from './error.js';
import { RateLimiterService } from './RateLimiterService.js';
import { ApiLoggerService } from './ApiLoggerService.js';
import { AuthenticateService, AuthenticationError } from './AuthenticateService.js';
import type { FastifyRequest, FastifyReply } from 'fastify';
import type { OnApplicationShutdown } from '@nestjs/common';
import type { IEndpointMeta, IEndpoint } from './endpoints.js';

View File

@ -1,5 +1,4 @@
import { Inject, Injectable } from '@nestjs/common';
import { FastifyInstance, FastifyPluginOptions } from 'fastify';
import cors from '@fastify/cors';
import multipart from '@fastify/multipart';
import { ModuleRef, repl } from '@nestjs/core';
@ -15,6 +14,7 @@ import { GithubServerService } from './integration/GithubServerService.js';
import { DiscordServerService } from './integration/DiscordServerService.js';
import { TwitterServerService } from './integration/TwitterServerService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
@Injectable()
export class ApiServerService {

View File

@ -3,7 +3,6 @@ import { Inject, Injectable } from '@nestjs/common';
import bcrypt from 'bcryptjs';
import * as speakeasy from 'speakeasy';
import { IsNull } from 'typeorm';
import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
import { DI } from '@/di-symbols.js';
import type { UserSecurityKeysRepository, SigninsRepository, UserProfilesRepository, AttestationChallengesRepository, UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
@ -14,6 +13,7 @@ import { TwoFactorAuthenticationService } from '@/core/TwoFactorAuthenticationSe
import { RateLimiterService } from './RateLimiterService.js';
import { SigninService } from './SigninService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyRequest, FastifyReply } from 'fastify';
@Injectable()
export class SigninApiService {

View File

@ -1,5 +1,4 @@
import { Inject, Injectable } from '@nestjs/common';
import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
import { DI } from '@/di-symbols.js';
import type { SigninsRepository, UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
@ -8,6 +7,7 @@ import type { ILocalUser } from '@/models/entities/User.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { SigninEntityService } from '@/core/entities/SigninEntityService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyRequest, FastifyReply } from 'fastify';
@Injectable()
export class SigninService {

View File

@ -1,7 +1,6 @@
import { Inject, Injectable } from '@nestjs/common';
import rndstr from 'rndstr';
import bcrypt from 'bcryptjs';
import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
import { DI } from '@/di-symbols.js';
import type { RegistrationTicketsRepository, UserPendingsRepository, UserProfilesRepository, UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
@ -15,6 +14,7 @@ import { ILocalUser } from '@/models/entities/User.js';
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
import { SigninService } from './SigninService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyRequest, FastifyReply } from 'fastify';
@Injectable()
export class SignupApiService {

View File

@ -3,7 +3,6 @@ import Redis from 'ioredis';
import { OAuth2 } from 'oauth';
import { v4 as uuid } from 'uuid';
import { IsNull } from 'typeorm';
import { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify';
import type { Config } from '@/config.js';
import type { UserProfilesRepository, UsersRepository } from '@/models/index.js';
import { DI } from '@/di-symbols.js';
@ -15,6 +14,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
import { bindThis } from '@/decorators.js';
import { SigninService } from '../SigninService.js';
import type { FastifyInstance, FastifyRequest, FastifyPluginOptions } from 'fastify';
@Injectable()
export class DiscordServerService {

View File

@ -3,7 +3,6 @@ import Redis from 'ioredis';
import { OAuth2 } from 'oauth';
import { v4 as uuid } from 'uuid';
import { IsNull } from 'typeorm';
import { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify';
import type { Config } from '@/config.js';
import type { UserProfilesRepository, UsersRepository } from '@/models/index.js';
import { DI } from '@/di-symbols.js';
@ -15,6 +14,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
import { bindThis } from '@/decorators.js';
import { SigninService } from '../SigninService.js';
import type { FastifyInstance, FastifyRequest, FastifyPluginOptions } from 'fastify';
@Injectable()
export class GithubServerService {

View File

@ -1,6 +1,5 @@
import { Inject, Injectable } from '@nestjs/common';
import Redis from 'ioredis';
import { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify';
import { v4 as uuid } from 'uuid';
import { IsNull } from 'typeorm';
import autwh from 'autwh';
@ -15,6 +14,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
import { bindThis } from '@/decorators.js';
import { SigninService } from '../SigninService.js';
import type { FastifyInstance, FastifyRequest, FastifyPluginOptions } from 'fastify';
@Injectable()
export class TwitterServerService {

View File

@ -9,7 +9,6 @@ import ms from 'ms';
import sharp from 'sharp';
import pug from 'pug';
import { In, IsNull } from 'typeorm';
import { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
import fastifyStatic from '@fastify/static';
import fastifyView from '@fastify/view';
import fastifyCookie from '@fastify/cookie';
@ -31,6 +30,7 @@ import { bindThis } from '@/decorators.js';
import manifest from './manifest.json' assert { type: 'json' };
import { FeedService } from './FeedService.js';
import { UrlPreviewService } from './UrlPreviewService.js';
import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);

View File

@ -1,6 +1,5 @@
import { Inject, Injectable } from '@nestjs/common';
import summaly from 'summaly';
import { FastifyRequest, FastifyReply } from 'fastify';
import { DI } from '@/di-symbols.js';
import type { UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
@ -10,6 +9,7 @@ import type Logger from '@/logger.js';
import { query } from '@/misc/prelude/url.js';
import { LoggerService } from '@/core/LoggerService.js';
import { bindThis } from '@/decorators.js';
import type { FastifyRequest, FastifyReply } from 'fastify';
@Injectable()
export class UrlPreviewService {

View File

@ -10,7 +10,7 @@
"declaration": false,
"sourceMap": false,
"target": "es2021",
"module": "es2022",
"module": "esnext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"removeComments": false,

View File

@ -2220,6 +2220,29 @@ __metadata:
languageName: node
linkType: hard
"@types/color-convert@npm:^2.0.0":
version: 2.0.0
resolution: "@types/color-convert@npm:2.0.0"
dependencies:
"@types/color-name": "*"
checksum: 027b68665dc2278cc2d83e796ada0a05a08aa5a11297e227c48c7f9f6eac518dec98578ab0072bd211963d3e4b431da70b20ea28d6c3136d0badfd3f9913baee
languageName: node
linkType: hard
"@types/color-name@npm:*":
version: 1.1.1
resolution: "@types/color-name@npm:1.1.1"
checksum: b71fcad728cc68abcba1d405742134410c8f8eb3c2ef18113b047afca158ad23a4f2c229bcf71a38f4a818dead375c45b20db121d0e69259c2d81e97a740daa6
languageName: node
linkType: hard
"@types/content-disposition@npm:^0.5.5":
version: 0.5.5
resolution: "@types/content-disposition@npm:0.5.5"
checksum: fdf7379db1d509990bcf9a21d85f05aad878596f28b1418f9179f6436cb22513262c670ce88c6055054a7f5804a9303eeacb70aa59a5e11ffdc1434559db9692
languageName: node
linkType: hard
"@types/disposable-email-domains@npm:^1.0.1":
version: 1.0.2
resolution: "@types/disposable-email-domains@npm:1.0.2"
@ -2314,6 +2337,15 @@ __metadata:
languageName: node
linkType: hard
"@types/ioredis@npm:4.28.10":
version: 4.28.10
resolution: "@types/ioredis@npm:4.28.10"
dependencies:
"@types/node": "*"
checksum: 0f2788cf25f490d3b345db8c5f8b8ce3f6c92cc99abcf744c8f974f02b9b3875233b3d22098614c462a0d6c41c523bd655509418ea88eb6249db6652290ce7cf
languageName: node
linkType: hard
"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1":
version: 2.0.4
resolution: "@types/istanbul-lib-coverage@npm:2.0.4"
@ -2667,6 +2699,13 @@ __metadata:
languageName: node
linkType: hard
"@types/syslog-pro@npm:^1.0.0":
version: 1.0.0
resolution: "@types/syslog-pro@npm:1.0.0"
checksum: d0dcd87efad8a629bba449f86a617605a3fbffa5c18a8b309c82e7b85036ac21cfd34711fd522f50528dd0f0d07bdb66261a6f9ef20f2a9133e847b2e717c1bc
languageName: node
linkType: hard
"@types/throttle-debounce@npm:5.0.0":
version: 5.0.0
resolution: "@types/throttle-debounce@npm:5.0.0"
@ -4045,8 +4084,11 @@ __metadata:
"@types/bcryptjs": 2.4.2
"@types/bull": 4.10.0
"@types/cbor": 6.0.0
"@types/color-convert": ^2.0.0
"@types/content-disposition": ^0.5.5
"@types/escape-regexp": 0.0.1
"@types/fluent-ffmpeg": 2.1.20
"@types/ioredis": 4.28.10
"@types/jest": 29.2.4
"@types/js-yaml": 4.0.5
"@types/jsdom": 20.0.1
@ -4070,6 +4112,7 @@ __metadata:
"@types/sharp": 0.31.0
"@types/sinonjs__fake-timers": 8.1.2
"@types/speakeasy": 2.0.7
"@types/syslog-pro": ^1.0.0
"@types/tinycolor2": 1.4.3
"@types/tmp": 0.2.3
"@types/unzipper": 0.10.5