[Refactoring] Fix some TS typings, update some dependencies (#1702)

This commit is contained in:
Alexander Zinchuk 2022-02-11 15:13:05 +01:00
parent 0e7f5658c4
commit 70774928fc
58 changed files with 1611 additions and 2099 deletions

View File

@ -1,4 +1,4 @@
// @ts-ignore // @ts-nocheck
const replaceInFile = require('replace-in-file'); const replaceInFile = require('replace-in-file');
const langPackIOs = require('./en-ios.json'); const langPackIOs = require('./en-ios.json');
const langPackExtra = require('./en-extra.json'); const langPackExtra = require('./en-extra.json');

View File

@ -1,4 +1,4 @@
// @ts-ignore // @ts-nocheck
const replaceInFile = require('replace-in-file'); const replaceInFile = require('replace-in-file');
const langPackAndroid = require('./en-android.json'); const langPackAndroid = require('./en-android.json');
const langPackIOs = require('./en-ios.json'); const langPackIOs = require('./en-ios.json');

3506
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@
"author": "Alexander Zinchuk (alexander@zinchuk.com)", "author": "Alexander Zinchuk (alexander@zinchuk.com)",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.12", "@babel/core": "^7.17.0",
"@babel/plugin-proposal-class-properties": "^7.16.7", "@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
@ -40,27 +40,27 @@
"@babel/preset-react": "^7.16.7", "@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7", "@babel/preset-typescript": "^7.16.7",
"@peculiar/webcrypto": "^1.2.3", "@peculiar/webcrypto": "^1.2.3",
"@testing-library/jest-dom": "^5.16.1", "@testing-library/jest-dom": "^5.16.2",
"@types/croppie": "^2.6.1", "@types/croppie": "^2.6.1",
"@types/css-font-loading-module": "0.0.7", "@types/css-font-loading-module": "0.0.7",
"@types/dom-mediacapture-record": "^1.0.11", "@types/dom-mediacapture-record": "^1.0.11",
"@types/jest": "^27.4.0", "@types/jest": "^27.4.0",
"@types/react": "^17.0.38", "@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^17.0.11",
"@types/resize-observer-browser": "^0.1.6", "@types/resize-observer-browser": "^0.1.7",
"@types/wicg-mediasession": "^1.1.3", "@types/wicg-mediasession": "^1.1.3",
"@typescript-eslint/eslint-plugin": "^5.10.1", "@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.10.1", "@typescript-eslint/parser": "^5.11.0",
"@webpack-cli/serve": "^1.6.1", "@webpack-cli/serve": "^1.6.1",
"autoprefixer": "^10.4.2", "autoprefixer": "^10.4.2",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"browserlist": "^1.0.1", "browserlist": "^1.0.1",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"css-loader": "^6.5.1", "css-loader": "^6.6.0",
"css-minimizer-webpack-plugin": "^3.4.1", "css-minimizer-webpack-plugin": "^3.4.1",
"dotenv": "^14.3.2", "dotenv": "^16.0.0",
"eslint": "^8.7.0", "eslint": "^8.8.0",
"eslint-config-airbnb-typescript": "^16.1.0", "eslint-config-airbnb-typescript": "^16.1.0",
"eslint-config-react-app": "^7.0.0", "eslint-config-react-app": "^7.0.0",
"eslint-import-resolver-webpack": "^0.13.2", "eslint-import-resolver-webpack": "^0.13.2",
@ -71,31 +71,25 @@
"eslint-plugin-no-null": "^1.0.2", "eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-react": "^7.28.0", "eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-teactn": "github:korenskoy/eslint-plugin-teactn#8fbd2b9", "eslint-plugin-teactn": "git+https://github.com/korenskoy/eslint-plugin-teactn#c2c39dd005d58c07c24c4361de804dce1c6261b5",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",
"husky": "^7.0.4", "husky": "^7.0.4",
"jest": "^27.4.7", "jest": "^27.5.0",
"jest-raw-loader": "^1.0.1", "jest-raw-loader": "^1.0.1",
"lint-staged": "^12.3.2", "lint-staged": "^12.3.3",
"mini-css-extract-plugin": "^2.5.3", "mini-css-extract-plugin": "^2.5.3",
"postcss-loader": "^6.2.1", "postcss-loader": "^6.2.1",
"postcss-modules": "^4.3.0", "postcss-modules": "^4.3.0",
"raw-loader": "^4.0.2",
"react": "^17.0.2", "react": "^17.0.2",
"replace-in-file": "^6.3.2", "replace-in-file": "^6.3.2",
"sass": "^1.49.0", "sass": "^1.49.7",
"sass-loader": "^12.4.0", "sass-loader": "^12.4.0",
"style-loader": "^3.3.1", "style-loader": "^3.3.1",
"terser": "^5.10.0",
"terser-webpack-plugin": "^5.3.0",
"ts-node": "^10.4.0",
"typescript": "^4.5.5", "typescript": "^4.5.5",
"url-loader": "^4.1.1", "webpack": "^5.68.0",
"webpack": "^5.67.0",
"webpack-bundle-analyzer": "^4.5.0", "webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2", "webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.3", "webpack-dev-server": "^4.7.4",
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"dependencies": { "dependencies": {

View File

@ -6,6 +6,9 @@ declare namespace React {
teactFastList?: boolean; teactFastList?: boolean;
} }
// Teact feature
interface CSSProperties extends String {}
interface Attributes { interface Attributes {
// Optimization for DOM nodes reordering. Requires `teactFastList` for parent // Optimization for DOM nodes reordering. Requires `teactFastList` for parent
teactOrderKey?: number; teactOrderKey?: number;
@ -45,13 +48,35 @@ type EmojiWithSkins = Record<number, Emoji>;
type AllEmojis = Record<string, Emoji | EmojiWithSkins>; type AllEmojis = Record<string, Emoji | EmojiWithSkins>;
// Declare supported for import formats as modules
declare module '*.png'; declare module '*.png';
declare module '*.svg';
declare module '*.tgs'; declare module '*.tgs';
declare module '*.txt' {
const content: string;
export default content;
}
declare module 'pako/dist/pako_inflate' { declare module 'pako/dist/pako_inflate' {
function inflate(...args: any[]): string; function inflate(...args: any[]): string;
} }
declare module 'opus-recorder' {
export interface IOpusRecorder extends Omit<MediaRecorder, 'start' | 'ondataavailable'> {
new(options: AnyLiteral): IOpusRecorder;
start(stream?: MediaStreamAudioSourceNode): void;
sourceNode: MediaStreamAudioSourceNode;
ondataavailable: (typedArray: Uint8Array) => void;
}
const recorder: IOpusRecorder;
export default recorder;
}
interface TEncodedImage { interface TEncodedImage {
result: Uint8ClampedArray; result: Uint8ClampedArray;
width: number; width: number;

View File

@ -1,6 +1,5 @@
import { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
// @ts-ignore
import monkeyPath from '../../assets/monkey.svg'; import monkeyPath from '../../assets/monkey.svg';
import React, { import React, {

View File

@ -61,7 +61,6 @@ const GroupCallParticipantStreams: FC<OwnProps & StateProps> = ({
'videos', 'videos',
shouldSpanLastVideo && 'span-last-video', shouldSpanLastVideo && 'span-last-video',
)} )}
// @ts-ignore teact feature
style={`--column-count: ${selectedVideo ? 1 : columnCount}`} style={`--column-count: ${selectedVideo ? 1 : columnCount}`}
> >
{selectedVideo && ( {selectedVideo && (

View File

@ -75,7 +75,6 @@ const AnimatedEmoji: FC<OwnProps> = ({
<div <div
ref={ref} ref={ref}
className={buildClassName('AnimatedEmoji media-inner', sticker.id === LIKE_STICKER_ID && 'like-sticker-thumb')} className={buildClassName('AnimatedEmoji media-inner', sticker.id === LIKE_STICKER_ID && 'like-sticker-thumb')}
// @ts-ignore teact feature
style={style} style={style}
onClick={handleClick} onClick={handleClick}
> >

View File

@ -223,7 +223,6 @@ const AnimatedSticker: FC<OwnProps> = ({
<div <div
ref={container} ref={container}
className={fullClassName} className={fullClassName}
// @ts-ignore
style={style} style={style}
/> />
); );

View File

@ -507,19 +507,16 @@ function renderSeekline(
> >
<span className="seekline-buffered-progress"> <span className="seekline-buffered-progress">
<i <i
// @ts-ignore
style={`transform: translateX(${bufferedProgress * 100}%)`} style={`transform: translateX(${bufferedProgress * 100}%)`}
/> />
</span> </span>
<span className="seekline-play-progress"> <span className="seekline-play-progress">
<i <i
// @ts-ignore
style={`transform: translateX(${playProgress * 100}%)`} style={`transform: translateX(${playProgress * 100}%)`}
/> />
</span> </span>
<span className="seekline-thumb"> <span className="seekline-thumb">
<i <i
// @ts-ignore
style={`transform: translateX(${playProgress * 100}%)`} style={`transform: translateX(${playProgress * 100}%)`}
/> />
</span> </span>

View File

@ -73,7 +73,6 @@ const GifButton: FC<OwnProps> = ({
ref={thumbRef} ref={thumbRef}
className="thumbnail" className="thumbnail"
// We need to always render to avoid blur re-calculation // We need to always render to avoid blur re-calculation
// @ts-ignore
style={isVideoReady ? 'display: none;' : undefined} style={isVideoReady ? 'display: none;' : undefined}
/> />
)} )}

View File

@ -62,7 +62,6 @@ const LocalAnimatedEmoji: FC<OwnProps> = ({
<div <div
ref={ref} ref={ref}
className="AnimatedEmoji media-inner" className="AnimatedEmoji media-inner"
// @ts-ignore teact feature
style={style} style={style}
onClick={handleClick} onClick={handleClick}
> >

View File

@ -105,7 +105,6 @@ const StickerButton: FC<OwnProps> = ({
ref={ref} ref={ref}
className={fullClassName} className={fullClassName}
title={title || (sticker?.emoji)} title={title || (sticker?.emoji)}
// @ts-ignore
style={style} style={style}
data-sticker-id={sticker.id} data-sticker-id={sticker.id}
onMouseDown={preventMessageInputBlurWithBubbling} onMouseDown={preventMessageInputBlurWithBubbling}

View File

@ -16,11 +16,8 @@ import buildClassName from '../../util/buildClassName';
import './UiLoader.scss'; import './UiLoader.scss';
// @ts-ignore
import telegramLogoPath from '../../assets/telegram-logo.svg'; import telegramLogoPath from '../../assets/telegram-logo.svg';
// @ts-ignore
import reactionThumbsPath from '../../assets/reaction-thumbs.png'; import reactionThumbsPath from '../../assets/reaction-thumbs.png';
// @ts-ignore
import monkeyPath from '../../assets/monkey.svg'; import monkeyPath from '../../assets/monkey.svg';
import { selectIsRightColumnShown, selectTheme } from '../../modules/selectors'; import { selectIsRightColumnShown, selectTheme } from '../../modules/selectors';
@ -138,7 +135,6 @@ const UiLoader: FC<OwnProps & StateProps> = ({
<> <>
<div <div
className="left" className="left"
// @ts-ignore teact feature
style={leftColumnWidth ? `width: ${leftColumnWidth}px` : undefined} style={leftColumnWidth ? `width: ${leftColumnWidth}px` : undefined}
/> />
<div <div

View File

@ -1,4 +1,3 @@
// @ts-ignore
import twemojiRegex from '../../../lib/twemojiRegex'; import twemojiRegex from '../../../lib/twemojiRegex';
const DETECT_UP_TO = 3; const DETECT_UP_TO = 3;

View File

@ -122,7 +122,6 @@ const ChatList: FC<OwnProps> = ({
folderId={folderId} folderId={folderId}
animationType={getAnimationType(id)} animationType={getAnimationType(id)}
orderDiff={orderDiffById[id]} orderDiff={orderDiffById[id]}
// @ts-ignore
style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`} style={`top: ${(viewportOffset + i) * CHAT_HEIGHT_PX}px;`}
/> />
)); ));

View File

@ -214,7 +214,6 @@ const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
<canvas /> <canvas />
<div <div
className="handle" className="handle"
// @ts-ignore
style={`transform: translate(${colorPosition[0]}px, ${colorPosition[1]}px); background-color: #${hex};`} style={`transform: translate(${colorPosition[0]}px, ${colorPosition[1]}px); background-color: #${hex};`}
/> />
</div> </div>
@ -222,7 +221,6 @@ const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
<canvas /> <canvas />
<div <div
className="handle" className="handle"
// @ts-ignore
style={`transform: translateX(${huePosition}px); background-color: #${hueHex};`} style={`transform: translateX(${huePosition}px); background-color: #${hueHex};`}
/> />
</div> </div>
@ -236,7 +234,6 @@ const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
<div <div
className={color === `#${hex}` ? 'active' : undefined} className={color === `#${hex}` ? 'active' : undefined}
data-color={color} data-color={color}
// @ts-ignore
style={`background-color: ${color};`} style={`background-color: ${color};`}
onClick={handlePredefinedColorClick} onClick={handlePredefinedColorClick}
/> />

View File

@ -293,7 +293,6 @@ function renderPhoto(blobUrl?: string, imageSize?: ApiDimensions, canDrag?: bool
<img <img
src={blobUrl} src={blobUrl}
alt="" alt=""
// @ts-ignore teact feature
style={imageSize ? `width: ${imageSize.width}px` : ''} style={imageSize ? `width: ${imageSize.width}px` : ''}
draggable={Boolean(canDrag)} draggable={Boolean(canDrag)}
/> />
@ -301,7 +300,6 @@ function renderPhoto(blobUrl?: string, imageSize?: ApiDimensions, canDrag?: bool
: ( : (
<div <div
className="spinner-wrapper" className="spinner-wrapper"
// @ts-ignore teact feature
style={imageSize ? `width: ${imageSize.width}px` : ''} style={imageSize ? `width: ${imageSize.width}px` : ''}
> >
<Spinner color="white" /> <Spinner color="white" />
@ -318,12 +316,10 @@ function renderVideoPreview(blobUrl?: string, imageSize?: ApiDimensions, canDrag
className="VideoPlayer" className="VideoPlayer"
> >
<div <div
// @ts-ignore
style={wrapperStyle} style={wrapperStyle}
> >
{/* eslint-disable-next-line jsx-a11y/media-has-caption */} {/* eslint-disable-next-line jsx-a11y/media-has-caption */}
<video <video
// @ts-ignore
style={videoStyle} style={videoStyle}
draggable={Boolean(canDrag)} draggable={Boolean(canDrag)}
/> />
@ -333,7 +329,6 @@ function renderVideoPreview(blobUrl?: string, imageSize?: ApiDimensions, canDrag
: ( : (
<div <div
className="spinner-wrapper" className="spinner-wrapper"
// @ts-ignore teact feature
style={imageSize ? `width: ${imageSize.width}px` : ''} style={imageSize ? `width: ${imageSize.width}px` : ''}
> >
<Spinner color="white" /> <Spinner color="white" />

View File

@ -506,7 +506,7 @@ const MediaViewerSlides: FC<OwnProps> = ({
return ( return (
<div className="MediaViewerSlides" ref={containerRef}> <div className="MediaViewerSlides" ref={containerRef}>
{previousMessageId && scale === 1 && /* @ts-ignore */ ( {previousMessageId && scale === 1 && (
<div className="MediaViewerSlide" style={getAnimationStyle(-window.innerWidth + offsetX - SLIDES_GAP)}> <div className="MediaViewerSlide" style={getAnimationStyle(-window.innerWidth + offsetX - SLIDES_GAP)}>
{/* eslint-disable-next-line react/jsx-props-no-spreading */} {/* eslint-disable-next-line react/jsx-props-no-spreading */}
<MediaViewerContent {...rest} messageId={previousMessageId} isFooterHidden={isFooterHidden} /> <MediaViewerContent {...rest} messageId={previousMessageId} isFooterHidden={isFooterHidden} />
@ -517,7 +517,6 @@ const MediaViewerSlides: FC<OwnProps> = ({
className={`MediaViewerSlide ${isActive ? 'MediaViewerSlide--active' : ''}`} className={`MediaViewerSlide ${isActive ? 'MediaViewerSlide--active' : ''}`}
onClick={handleToggleFooterVisibility} onClick={handleToggleFooterVisibility}
ref={activeSlideRef} ref={activeSlideRef}
/* @ts-ignore */
style={getAnimationStyle(offsetX, offsetY, scale)} style={getAnimationStyle(offsetX, offsetY, scale)}
> >
<MediaViewerContent <MediaViewerContent
@ -529,7 +528,7 @@ const MediaViewerSlides: FC<OwnProps> = ({
/> />
</div> </div>
)} )}
{nextMessageId && scale === 1 && /* @ts-ignore */ ( {nextMessageId && scale === 1 && (
<div className="MediaViewerSlide" style={getAnimationStyle(window.innerWidth + offsetX + SLIDES_GAP)}> <div className="MediaViewerSlide" style={getAnimationStyle(window.innerWidth + offsetX + SLIDES_GAP)}>
{/* eslint-disable-next-line react/jsx-props-no-spreading */} {/* eslint-disable-next-line react/jsx-props-no-spreading */}
<MediaViewerContent {...rest} messageId={nextMessageId} isFooterHidden={isFooterHidden} /> <MediaViewerContent {...rest} messageId={nextMessageId} isFooterHidden={isFooterHidden} />

View File

@ -157,7 +157,6 @@ const VideoPlayer: FC<OwnProps> = ({
onMouseOut={!isGif && !IS_TOUCH_ENV ? handleMouseOut : undefined} onMouseOut={!isGif && !IS_TOUCH_ENV ? handleMouseOut : undefined}
> >
<div <div
// @ts-ignore
style={wrapperStyle} style={wrapperStyle}
> >
{/* eslint-disable-next-line jsx-a11y/media-has-caption */} {/* eslint-disable-next-line jsx-a11y/media-has-caption */}
@ -169,7 +168,6 @@ const VideoPlayer: FC<OwnProps> = ({
// This is to force auto playing on mobiles // This is to force auto playing on mobiles
muted={isGif} muted={isGif}
id="media-viewer-video" id="media-viewer-video"
// @ts-ignore
style={videoStyle} style={videoStyle}
onPlay={IS_IOS ? () => setIsPlayed(true) : undefined} onPlay={IS_IOS ? () => setIsPlayed(true) : undefined}
onEnded={handleEnded} onEnded={handleEnded}

View File

@ -180,12 +180,10 @@ function renderSeekLine(
<div className="player-seekline-track"> <div className="player-seekline-track">
<div <div
className="player-seekline-buffered" className="player-seekline-buffered"
// @ts-ignore teact feature
style={`width: ${percentageBuffered || 0}%`} style={`width: ${percentageBuffered || 0}%`}
/> />
<div <div
className="player-seekline-played" className="player-seekline-played"
// @ts-ignore teact feature
style={`width: ${percentagePlayed || 0}%`} style={`width: ${percentagePlayed || 0}%`}
/> />
</div> </div>

View File

@ -102,7 +102,6 @@ const ZoomControls: FC<OwnProps> = ({ isShown, onChangeZoom }) => {
<div className="seekline-track"> <div className="seekline-track">
<div <div
className="seekline-played" className="seekline-played"
// @ts-ignore teact feature
style={`width: ${(zoomLevel - 1) * ONE_STEP_PERCENT}%`} style={`width: ${(zoomLevel - 1) * ONE_STEP_PERCENT}%`}
/> />
<input <input

View File

@ -93,7 +93,6 @@ const EmojiInteractionAnimation: FC<OwnProps & StateProps> = ({
className={buildClassName( className={buildClassName(
'EmojiInteractionAnimation', isHiding && 'hiding', isPlaying && 'playing', isReversed && 'reversed', 'EmojiInteractionAnimation', isHiding && 'hiding', isPlaying && 'playing', isReversed && 'reversed',
)} )}
// @ts-ignore teact feature
style={`--scale: ${scale}; --start-x: ${emojiInteraction.x}px; --start-y: ${emojiInteraction.y}px;`} style={`--scale: ${scale}; --start-x: ${emojiInteraction.x}px; --start-y: ${emojiInteraction.y}px;`}
> >
<AnimatedSticker <AnimatedSticker

View File

@ -339,8 +339,6 @@ const MessageList: FC<OwnProps & StateProps> = ({
// Handles updated message list, takes care of scroll repositioning // Handles updated message list, takes care of scroll repositioning
useLayoutEffectWithPrevDeps(([ useLayoutEffectWithPrevDeps(([
prevMessageIds, prevIsViewportNewest, prevContainerHeight, prevMessageIds, prevIsViewportNewest, prevContainerHeight,
]: [
typeof messageIds, typeof isViewportNewest, typeof containerHeight,
]) => { ]) => {
const container = containerRef.current!; const container = containerRef.current!;
listItemElementsRef.current = Array.from(container.querySelectorAll<HTMLDivElement>('.message-list-item')); listItemElementsRef.current = Array.from(container.querySelectorAll<HTMLDivElement>('.message-list-item'));
@ -463,7 +461,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
console.timeEnd('scrollTop'); console.timeEnd('scrollTop');
} }
// This should match deps for `useOnChange` above // This should match deps for `useOnChange` above
}, [messageIds, isViewportNewest, containerHeight, hasTools]); }, [messageIds, isViewportNewest, containerHeight, hasTools] as const);
useEffectWithPrevDeps(([prevIsSelectModeActive]) => { useEffectWithPrevDeps(([prevIsSelectModeActive]) => {
if (prevIsSelectModeActive !== undefined) { if (prevIsSelectModeActive !== undefined) {

View File

@ -363,7 +363,6 @@ const MiddleColumn: FC<StateProps> = ({
id="MiddleColumn" id="MiddleColumn"
className={className} className={className}
onTransitionEnd={handleOpenEnd} onTransitionEnd={handleOpenEnd}
// @ts-ignore teact-feature
style={` style={`
--composer-hidden-scale: ${composerHiddenScale}; --composer-hidden-scale: ${composerHiddenScale};
--toolbar-hidden-scale: ${toolbarHiddenScale}; --toolbar-hidden-scale: ${toolbarHiddenScale};
@ -379,7 +378,6 @@ const MiddleColumn: FC<StateProps> = ({
> >
<div <div
id="middle-column-bg" id="middle-column-bg"
// @ts-ignore
style={customBackgroundValue ? `--custom-background: ${customBackgroundValue}` : undefined} style={customBackgroundValue ? `--custom-background: ${customBackgroundValue}` : undefined}
/> />
<div id="middle-column-portals" /> <div id="middle-column-portals" />

View File

@ -84,7 +84,6 @@ const PinnedMessageNavigation: FC<OwnProps> = ({
<div <div
className="pinned-message-border-wrapper" className="pinned-message-border-wrapper"
ref={containerRef} ref={containerRef}
// @ts-ignore
style={ style={
`clip-path: url("#${clipPathId}"); width: 2px; `clip-path: url("#${clipPathId}"); width: 2px;
height: ${trackHeight}px; transform: translateY(-${trackTranslateY}px);` height: ${trackHeight}px; transform: translateY(-${trackTranslateY}px);`
@ -93,7 +92,6 @@ const PinnedMessageNavigation: FC<OwnProps> = ({
<span /> <span />
<div <div
className="pinned-message-border-mark" className="pinned-message-border-mark"
// @ts-ignore
style={`height: ${markHeight}px; transform: translateY(${markTranslateY}px);`} style={`height: ${markHeight}px; transform: translateY(${markTranslateY}px);`}
/> />
</div> </div>

View File

@ -52,7 +52,6 @@ const EmojiCategory: FC<OwnProps> = ({
</p> </p>
<div <div
className={buildClassName('symbol-set-container', transitionClassNames)} className={buildClassName('symbol-set-container', transitionClassNames)}
// @ts-ignore
style={`height: ${height}px;`} style={`height: ${height}px;`}
dir={lang.isRtl ? 'rtl' : undefined} dir={lang.isRtl ? 'rtl' : undefined}
> >

View File

@ -56,7 +56,6 @@ const StickerSet: FC<OwnProps> = ({
<p className="symbol-set-name">{stickerSet.title}</p> <p className="symbol-set-name">{stickerSet.title}</p>
<div <div
className={buildClassName('symbol-set-container', transitionClassNames)} className={buildClassName('symbol-set-container', transitionClassNames)}
// @ts-ignore
style={`height: ${height}px;`} style={`height: ${height}px;`}
> >
{shouldRender && stickerSet.stickers && stickerSet.stickers.map((sticker) => ( {shouldRender && stickerSet.stickers && stickerSet.stickers.map((sticker) => (

View File

@ -406,7 +406,6 @@ const TextFormatter: FC<OwnProps> = ({
<div <div
ref={containerRef} ref={containerRef}
className={className} className={className}
// @ts-ignore Teact feature
style={style} style={style}
onKeyDown={handleContainerKeyDown} onKeyDown={handleContainerKeyDown}
> >

View File

@ -122,7 +122,6 @@ const Album: FC<OwnProps & StateProps> = ({
return ( return (
<div <div
className="Album" className="Album"
// @ts-ignore
style={`width: ${containerWidth}px; height: ${containerHeight}px;`} style={`width: ${containerWidth}px; height: ${containerHeight}px;`}
> >
{album.messages.map(renderAlbumMessage)} {album.messages.map(renderAlbumMessage)}

View File

@ -827,7 +827,6 @@ const Message: FC<OwnProps & StateProps> = ({
ref={ref} ref={ref}
id={`message${messageId}`} id={`message${messageId}`}
className={containerClassName} className={containerClassName}
// @ts-ignore teact feature
style={metaSafeAuthorWidth ? `--meta-safe-author-width: ${metaSafeAuthorWidth}px` : undefined} style={metaSafeAuthorWidth ? `--meta-safe-author-width: ${metaSafeAuthorWidth}px` : undefined}
data-message-id={messageId} data-message-id={messageId}
onMouseDown={handleMouseDown} onMouseDown={handleMouseDown}
@ -867,7 +866,6 @@ const Message: FC<OwnProps & StateProps> = ({
<div <div
ref={contentRef} ref={contentRef}
className={contentClassName} className={contentClassName}
// @ts-ignore
style={style} style={style}
dir="auto" dir="auto"
> >

View File

@ -216,7 +216,6 @@ const MessageContextMenu: FC<OwnProps> = ({
<div <div
className="scrollable-content custom-scroll" className="scrollable-content custom-scroll"
// @ts-ignore teact feature
style={menuStyle} style={menuStyle}
ref={scrollableRef} ref={scrollableRef}
> >

View File

@ -153,14 +153,12 @@ const Photo: FC<OwnProps> = ({
id={id} id={id}
ref={ref} ref={ref}
className={className} className={className}
// @ts-ignore teact feature
style={style} style={style}
onClick={isUploading ? undefined : handleClick} onClick={isUploading ? undefined : handleClick}
> >
<canvas <canvas
ref={thumbRef} ref={thumbRef}
className="thumbnail" className="thumbnail"
// @ts-ignore teact feature
style={`width: ${width}px; height: ${height}px`} style={`width: ${width}px; height: ${height}px`}
/> />
<img <img

View File

@ -89,7 +89,6 @@ const PollOption: FC<OwnProps> = ({
<div className="poll-option-corner" ref={lineRef} /> <div className="poll-option-corner" ref={lineRef} />
<div <div
className="poll-option-line" className="poll-option-line"
// @ts-ignore
style={lineStyle} style={lineStyle}
/> />
</div> </div>

View File

@ -59,7 +59,6 @@ const ReactionSelectorReaction: FC<OwnProps> = ({ reaction, previewIndex, onSend
'static', 'static',
isReady ? [staticClassNames] : undefined, isReady ? [staticClassNames] : undefined,
)} )}
// @ts-ignore
style={`background-position-x: ${previewIndex * -32}px;`} style={`background-position-x: ${previewIndex * -32}px;`}
/> />
)} )}

View File

@ -207,7 +207,6 @@ const RoundVideo: FC<OwnProps> = ({
<canvas <canvas
ref={thumbRef} ref={thumbRef}
className="thumbnail" className="thumbnail"
// @ts-ignore teact feature
style={`width: ${ROUND_VIDEO_DIMENSIONS_PX}px; height: ${ROUND_VIDEO_DIMENSIONS_PX}px`} style={`width: ${ROUND_VIDEO_DIMENSIONS_PX}px; height: ${ROUND_VIDEO_DIMENSIONS_PX}px`}
/> />
</div> </div>

View File

@ -159,20 +159,17 @@ const Video: FC<OwnProps> = ({
ref={ref} ref={ref}
id={id} id={id}
className={className} className={className}
// @ts-ignore teact feature
style={style} style={style}
onClick={isUploading ? undefined : handleClick} onClick={isUploading ? undefined : handleClick}
> >
<canvas <canvas
ref={thumbRef} ref={thumbRef}
className="thumbnail" className="thumbnail"
// @ts-ignore teact feature
style={`width: ${width}px; height: ${height}px;`} style={`width: ${width}px; height: ${height}px;`}
/> />
<img <img
src={previewBlobUrl} src={previewBlobUrl}
className={buildClassName('thumbnail', previewClassNames)} className={buildClassName('thumbnail', previewClassNames)}
// @ts-ignore teact feature
style={`width: ${width}px; height: ${height}px;`} style={`width: ${width}px; height: ${height}px;`}
alt="" alt=""
draggable={!isProtected} draggable={!isProtected}

View File

@ -57,7 +57,6 @@ export default function withSelectControl(WrappedComponent: FC) {
return ( return (
<div <div
className={buildClassName('album-item-select-wrapper', isSelected && 'is-selected')} className={buildClassName('album-item-select-wrapper', isSelected && 'is-selected')}
// @ts-ignore
style={dimensions ? `left: ${dimensions.x}px; top: ${dimensions.y}px;` : ''} style={dimensions ? `left: ${dimensions.x}px; top: ${dimensions.y}px;` : ''}
onClick={isInSelectMode ? handleMessageSelect : undefined} onClick={isInSelectMode ? handleMessageSelect : undefined}
> >

View File

@ -10,9 +10,7 @@ import InputText from '../ui/InputText';
import './CardInput.scss'; import './CardInput.scss';
// @ts-ignore
import mastercardIconPath from '../../assets/mastercard.svg'; import mastercardIconPath from '../../assets/mastercard.svg';
// @ts-ignore
import visaIconPath from '../../assets/visa.svg'; import visaIconPath from '../../assets/visa.svg';
const CARD_NUMBER_MAX_LENGTH = 23; const CARD_NUMBER_MAX_LENGTH = 23;

View File

@ -26,7 +26,6 @@ const TestPortal: FC = () => {
</div> </div>
<Portal> <Portal>
<div <div
// @ts-ignore
style={`position: absolute; top: ${position}px; left: ${position}px; width: 250px;`} style={`position: absolute; top: ${position}px; left: ${position}px; width: 250px;`}
> >
<h2> <h2>

View File

@ -153,7 +153,6 @@ const Button: FC<OwnProps> = ({
title={ariaLabel} title={ariaLabel}
tabIndex={tabIndex} tabIndex={tabIndex}
dir={isRtl ? 'rtl' : undefined} dir={isRtl ? 'rtl' : undefined}
// @ts-ignore
style={backgroundImage ? `background-image: url(${backgroundImage})` : undefined} style={backgroundImage ? `background-image: url(${backgroundImage})` : undefined}
> >
{isLoading ? ( {isLoading ? (

View File

@ -225,7 +225,6 @@ const InfiniteScroll: FC<OwnProps> = ({
{withAbsolutePositioning && items?.length ? ( {withAbsolutePositioning && items?.length ? (
<div <div
teactFastList={!noFastList} teactFastList={!noFastList}
// @ts-ignore
style={`position: relative;${IS_ANDROID ? ` height: ${maxHeight}px;` : undefined}`} style={`position: relative;${IS_ANDROID ? ` height: ${maxHeight}px;` : undefined}`}
> >
{children} {children}

View File

@ -160,7 +160,6 @@ const ListItem: FC<OwnProps> = ({
ref={containerRef} ref={containerRef}
className={fullClassName} className={fullClassName}
dir={lang.isRtl ? 'rtl' : undefined} dir={lang.isRtl ? 'rtl' : undefined}
// @ts-ignore
style={style} style={style}
onMouseDown={onMouseDown} onMouseDown={onMouseDown}
> >

View File

@ -114,7 +114,6 @@ const Menu: FC<OwnProps> = ({
onKeyDown={isOpen ? handleKeyDown : undefined} onKeyDown={isOpen ? handleKeyDown : undefined}
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={isOpen ? onMouseLeave : undefined} onMouseLeave={isOpen ? onMouseLeave : undefined}
// @ts-ignore teact feature
style={style} style={style}
> >
{isOpen && ( {isOpen && (
@ -124,7 +123,6 @@ const Menu: FC<OwnProps> = ({
<div <div
ref={menuRef} ref={menuRef}
className={bubbleClassName} className={bubbleClassName}
// @ts-ignore teact feature
style={`transform-origin: ${transformOriginXStyle || positionX} ${transformOriginYStyle || positionY};${ style={`transform-origin: ${transformOriginXStyle || positionX} ${transformOriginYStyle || positionY};${
bubbleStyle || ''}`} bubbleStyle || ''}`}
onClick={autoClose ? onClose : undefined} onClick={autoClose ? onClose : undefined}

View File

@ -63,7 +63,6 @@ const RangeSlider: FC<OwnProps> = ({
<div className="slider-main"> <div className="slider-main">
<div <div
className="slider-fill-track" className="slider-fill-track"
// @ts-ignore
style={`width: ${trackWidth}%`} style={`width: ${trackWidth}%`}
/> />
<input <input

View File

@ -50,7 +50,6 @@ const RippleEffect: FC = () => {
<div className="ripple-container" onMouseDown={handleMouseDown}> <div className="ripple-container" onMouseDown={handleMouseDown}>
{ripples.map(({ x, y, size }) => ( {ripples.map(({ x, y, size }) => (
<span <span
// @ts-ignore
style={`left: ${x}px; top: ${y}px; width: ${size}px; height: ${size}px;`} style={`left: ${x}px; top: ${y}px; width: ${size}px; height: ${size}px;`}
/> />
))} ))}

View File

@ -1,10 +1,9 @@
import { useEffect } from '../lib/teact/teact'; import { useEffect } from '../lib/teact/teact';
import usePrevious from './usePrevious'; import usePrevious from './usePrevious';
const useEffectWithPrevDeps = <T extends any[], PT = T>(cb: (args: PT) => void, dependencies: T, debugKey?: string) => { const useEffectWithPrevDeps = <T extends any[]>(cb: (args: T | []) => void, dependencies: T, debugKey?: string) => {
const prevDeps = usePrevious<T>(dependencies); const prevDeps = usePrevious<T>(dependencies);
return useEffect(() => { return useEffect(() => {
// @ts-ignore (workaround for "could be instantiated with a different subtype" issue)
return cb(prevDeps || []); return cb(prevDeps || []);
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, dependencies, debugKey); }, dependencies, debugKey);

View File

@ -1,12 +1,11 @@
import { useLayoutEffect } from '../lib/teact/teact'; import { useLayoutEffect } from '../lib/teact/teact';
import usePrevious from './usePrevious'; import usePrevious from './usePrevious';
const useLayoutEffectWithPrevDeps = <T extends any[], PT = T>( const useLayoutEffectWithPrevDeps = <T extends readonly any[]>(
cb: (args: PT) => void, dependencies: T, debugKey?: string, cb: (args: T | readonly []) => void, dependencies: T, debugKey?: string,
) => { ) => {
const prevDeps = usePrevious<T>(dependencies); const prevDeps = usePrevious<T>(dependencies);
return useLayoutEffect(() => { return useLayoutEffect(() => {
// @ts-ignore (workaround for "could be instantiated with a different subtype" issue)
return cb(prevDeps || []); return cb(prevDeps || []);
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, dependencies, debugKey); }, dependencies, debugKey);

View File

@ -5,11 +5,10 @@ import { ApiMediaFormat } from '../api/types';
import * as mediaLoader from '../util/mediaLoader'; import * as mediaLoader from '../util/mediaLoader';
import useForceUpdate from './useForceUpdate'; import useForceUpdate from './useForceUpdate';
const useMedia = <T extends ApiMediaFormat = ApiMediaFormat.BlobUrl>( const useMedia = (
mediaHash: string | false | undefined, mediaHash: string | false | undefined,
noLoad = false, noLoad = false,
// @ts-ignore (workaround for "could be instantiated with a different subtype" issue) mediaFormat = ApiMediaFormat.BlobUrl,
mediaFormat: T = ApiMediaFormat.BlobUrl,
cacheBuster?: number, cacheBuster?: number,
delay?: number | false, delay?: number | false,
) => { ) => {

View File

@ -13,11 +13,10 @@ const STREAMING_PROGRESS = 0.75;
const STREAMING_TIMEOUT = 1500; const STREAMING_TIMEOUT = 1500;
const PROGRESS_THROTTLE = 500; const PROGRESS_THROTTLE = 500;
export default function useMediaWithLoadProgress<T extends ApiMediaFormat = ApiMediaFormat.BlobUrl>( export default function useMediaWithLoadProgress(
mediaHash: string | undefined, mediaHash: string | undefined,
noLoad = false, noLoad = false,
// @ts-ignore (workaround for "could be instantiated with a different subtype" issue) mediaFormat = ApiMediaFormat.BlobUrl,
mediaFormat: T = ApiMediaFormat.BlobUrl,
cacheBuster?: number, cacheBuster?: number,
delay?: number | false, delay?: number | false,
isHtmlAllowed = false, isHtmlAllowed = false,

View File

@ -14,7 +14,6 @@ import { buildMediaMetadata } from '../util/mediaSession';
import { scaleImage, resizeImage } from '../util/imageResize'; import { scaleImage, resizeImage } from '../util/imageResize';
import { AVATAR_FULL_DIMENSIONS } from '../components/common/helpers/mediaDimensions'; import { AVATAR_FULL_DIMENSIONS } from '../components/common/helpers/mediaDimensions';
// @ts-ignore
import telegramLogoPath from '../assets/telegram-logo-filled.svg'; import telegramLogoPath from '../assets/telegram-logo-filled.svg';
const LOGO_DIMENSIONS = { width: 200, height: 200 }; const LOGO_DIMENSIONS = { width: 200, height: 200 };

View File

@ -1,9 +1,8 @@
import usePrevious from './usePrevious'; import usePrevious from './usePrevious';
const useOnChange = <T extends any[], PT = T>(cb: (args: PT) => void, dependencies: T) => { const useOnChange = <T extends any[]>(cb: (args: T | []) => void, dependencies: T) => {
const prevDeps = usePrevious<T>(dependencies); const prevDeps = usePrevious<T>(dependencies);
if (!prevDeps || dependencies.some((d, i) => d !== prevDeps[i])) { if (!prevDeps || dependencies.some((d, i) => d !== prevDeps[i])) {
// @ts-ignore (workaround for "could be instantiated with a different subtype" issue)
cb(prevDeps || []); cb(prevDeps || []);
} }
}; };

View File

@ -163,7 +163,6 @@ function buildArgConfig(name, argType) {
// Note that 'flags' is NOT the flags name; this // Note that 'flags' is NOT the flags name; this
// is determined by a previous argument // is determined by a previous argument
// However, we assume that the argument will always be called 'flags' // However, we assume that the argument will always be called 'flags'
// @ts-ignore
const flagMatch = currentConfig.type.match(/flags.(\d+)\?([\w<>.]+)/); const flagMatch = currentConfig.type.match(/flags.(\d+)\?([\w<>.]+)/);
if (flagMatch) { if (flagMatch) {
@ -174,7 +173,6 @@ function buildArgConfig(name, argType) {
} }
// Then check if the type is a Vector<REAL_TYPE> // Then check if the type is a Vector<REAL_TYPE>
// @ts-ignore
const vectorMatch = currentConfig.type.match(/[Vv]ector<([\w\d.]+)>/); const vectorMatch = currentConfig.type.match(/[Vv]ector<([\w\d.]+)>/);
if (vectorMatch) { if (vectorMatch) {
@ -182,7 +180,6 @@ function buildArgConfig(name, argType) {
// If the type's first letter is not uppercase, then // If the type's first letter is not uppercase, then
// it is a constructor and we use (read/write) its ID. // it is a constructor and we use (read/write) its ID.
// @ts-ignore
currentConfig.useVectorId = currentConfig.type.charAt(0) === 'V'; currentConfig.useVectorId = currentConfig.type.charAt(0) === 'V';
// Update the type to match the one inside the vector // Update the type to match the one inside the vector
@ -191,7 +188,6 @@ function buildArgConfig(name, argType) {
// See use_vector_id. An example of such case is ipPort in // See use_vector_id. An example of such case is ipPort in
// help.configSpecial // help.configSpecial
// @ts-ignore
if (/^[a-z]$/.test(currentConfig.type.split('.') if (/^[a-z]$/.test(currentConfig.type.split('.')
.pop() .pop()
.charAt(0)) .charAt(0))

View File

@ -69,7 +69,7 @@ interface ComponentInstance {
cursor: number; cursor: number;
byCursor: { byCursor: {
effect: () => void; effect: () => void;
dependencies?: any[]; dependencies?: readonly any[];
cleanup?: Function; cleanup?: Function;
}[]; }[];
}; };
@ -522,7 +522,7 @@ function useLayoutEffectBase(
schedulerFn: typeof onTickEnd | typeof requestAnimationFrame, schedulerFn: typeof onTickEnd | typeof requestAnimationFrame,
primarySchedulerFn: typeof onTickEnd | typeof requestAnimationFrame, primarySchedulerFn: typeof onTickEnd | typeof requestAnimationFrame,
effect: () => Function | void, effect: () => Function | void,
dependencies?: any[], dependencies?: readonly any[],
debugKey?: string, debugKey?: string,
) { ) {
const { cursor, byCursor } = renderingInstance.hooks.effects; const { cursor, byCursor } = renderingInstance.hooks.effects;
@ -621,11 +621,11 @@ function useLayoutEffectBase(
renderingInstance.hooks.effects.cursor++; renderingInstance.hooks.effects.cursor++;
} }
export function useEffect(effect: () => Function | void, dependencies?: any[], debugKey?: string) { export function useEffect(effect: () => Function | void, dependencies?: readonly any[], debugKey?: string) {
return useLayoutEffectBase(fastRaf, fastRafPrimary, effect, dependencies, debugKey); return useLayoutEffectBase(fastRaf, fastRafPrimary, effect, dependencies, debugKey);
} }
export function useLayoutEffect(effect: () => Function | void, dependencies?: any[], debugKey?: string) { export function useLayoutEffect(effect: () => Function | void, dependencies?: readonly any[], debugKey?: string) {
return useLayoutEffectBase(onTickEnd, onTickEndPrimary, effect, dependencies, debugKey); return useLayoutEffectBase(onTickEnd, onTickEndPrimary, effect, dependencies, debugKey);
} }

View File

@ -36,7 +36,6 @@ import {
import { findLast } from '../../../util/iteratees'; import { findLast } from '../../../util/iteratees';
import { getServerTime } from '../../../util/serverTime'; import { getServerTime } from '../../../util/serverTime';
// @ts-ignore
import versionNotification from '../../../versionNotification.txt'; import versionNotification from '../../../versionNotification.txt';
import parseMessageInput from '../../../util/parseMessageInput'; import parseMessageInput from '../../../util/parseMessageInput';

View File

@ -94,13 +94,11 @@ export function setPositionState(state?: MediaPositionState) {
export function setMicrophoneActive(active: boolean) { export function setMicrophoneActive(active: boolean) {
const { mediaSession } = window.navigator; const { mediaSession } = window.navigator;
// @ts-ignore typings not updated yet
mediaSession?.setMicrophoneActive?.(active); mediaSession?.setMicrophoneActive?.(active);
} }
export function setCameraActive(active: boolean) { export function setCameraActive(active: boolean) {
const { mediaSession } = window.navigator; const { mediaSession } = window.navigator;
// @ts-ignore typings not updated yet
mediaSession?.setCameraActive?.(active); mediaSession?.setCameraActive?.(active);
} }

View File

@ -1,18 +1,8 @@
// @ts-ignore import { IOpusRecorder } from 'opus-recorder';
import encoderPath from 'file-loader!opus-recorder/dist/encoderWorker.min';
export type Result = { blob: Blob; duration: number; waveform: number[] }; export type Result = { blob: Blob; duration: number; waveform: number[] };
interface IOpusRecorder extends Omit<MediaRecorder, 'start' | 'ondataavailable'> { const encoderPath = new URL('opus-recorder/dist/encoderWorker.min', import.meta.url).href;
new(options: AnyLiteral): IOpusRecorder;
start(stream?: MediaStreamAudioSourceNode): void;
sourceNode: MediaStreamAudioSourceNode;
ondataavailable: (typedArray: Uint8Array) => void;
}
const MIN_RECORDING_TIME = 1000; const MIN_RECORDING_TIME = 1000;
const POLYFILL_OPTIONS = { encoderPath, reuseWorker: true }; const POLYFILL_OPTIONS = { encoderPath, reuseWorker: true };
const BLOB_PARAMS = { type: 'audio/ogg' }; const BLOB_PARAMS = { type: 'audio/ogg' };
@ -25,7 +15,6 @@ let mediaRecorder: IOpusRecorder;
export async function init() { export async function init() {
if (!opusRecorderPromise) { if (!opusRecorderPromise) {
// @ts-ignore
opusRecorderPromise = import('opus-recorder'); opusRecorderPromise = import('opus-recorder');
OpusRecorder = (await opusRecorderPromise).default; OpusRecorder = (await opusRecorderPromise).default;
mediaRecorder = new OpusRecorder(POLYFILL_OPTIONS); mediaRecorder = new OpusRecorder(POLYFILL_OPTIONS);

View File

@ -8,7 +8,6 @@ const {
const HtmlPlugin = require('html-webpack-plugin'); const HtmlPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const TerserJSPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
dotenv.config(); dotenv.config();
@ -86,25 +85,13 @@ module.exports = (env = {}, argv = {}) => {
test: /\.(woff(2)?|ttf|eot|svg|png|jpg|tgs)(\?v=\d+\.\d+\.\d+)?$/, test: /\.(woff(2)?|ttf|eot|svg|png|jpg|tgs)(\?v=\d+\.\d+\.\d+)?$/,
type: 'asset/resource', type: 'asset/resource',
}, },
{
test: /-extra\.json$/,
loader: 'file-loader',
type: 'javascript/auto',
options: {
name: '[name].[contenthash].[ext]',
},
},
{ {
test: /\.wasm$/, test: /\.wasm$/,
loader: 'file-loader', type: 'asset/resource',
type: 'javascript/auto',
options: {
name: '[name].[contenthash].[ext]',
},
}, },
{ {
test: /\.(txt|tl)$/i, test: /\.(txt|tl)$/i,
loader: 'raw-loader', type: 'asset/source',
}, },
], ],
}, },
@ -153,7 +140,6 @@ module.exports = (env = {}, argv = {}) => {
optimization: { optimization: {
minimize: !env.noMinify, minimize: !env.noMinify,
minimizer: [ minimizer: [
new TerserJSPlugin({ sourceMap: true }),
new CssMinimizerPlugin(), new CssMinimizerPlugin(),
], ],
}, },