Fix import related TypeScript errors (#9321)
* Add missing @types packages * Fix TS1272 type only imports * Fix TS2821 import assertion
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							f30d54fe88
						
					
				
				
					commit
					4b98920f02
				
			@@ -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",
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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';
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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';
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@
 | 
			
		||||
		"declaration": false,
 | 
			
		||||
		"sourceMap": false,
 | 
			
		||||
		"target": "es2021",
 | 
			
		||||
		"module": "es2022",
 | 
			
		||||
		"module": "esnext",
 | 
			
		||||
		"moduleResolution": "node",
 | 
			
		||||
		"allowSyntheticDefaultImports": true,
 | 
			
		||||
		"removeComments": false,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user