Skip to content

ts-loader compatibility with typescript 5.6.3 ? #1659

@vitto-moz

Description

@vitto-moz

Expected Behaviour

I use emotion.d.ts file to redeclare the Theme interface, and everything works fine with typescript 5.5.4, but after updated to typescript 5.6.3 the build fails with errors pointing on ts-loader.

Actual Behaviour

After the Typescript version update to 5.6.3 looks like emotion.d.ts is skipped by compiler, and there are errors that point on the default Theme interface which is just empty object.

[tsl] ERROR in C:\some-path\components\Page.tsx(63,38)
      TS2339: Property 'colors' does not exist on type 'Theme'.
ts-loader-default_321045a7e6183ef3
Error: [tsl] ERROR in C:\some-path\Page.tsx(63,38)
      TS2339: Property 'colors' does not exist on type 'Theme'.
    at makeError (C:\some-path\node_modules\ts-loader\dist\utils.js:93:19)
    at C:\some-path\node_modules\ts-loader\dist\utils.js:63:27
    at Array.map (<anonymous>)
    at formatErrors (C:\some-path\node_modules\ts-loader\dist\utils.js:46:14)
    at provideErrorsToWebpack (C:\some-path\node_modules\ts-loader\dist\after-compile.js:167:62)
    at C:\some-path\node_modules\ts-loader\dist\after-compile.js:36:9
    at C:\some-path\node_modules\ts-loader\dist\instances.js:206:13
    at fn (C:\some-path\node_modules\webpack\lib\Compilation.js:491:10)
    at Hook.eval [as callAsync] (eval at create (C:\some-path\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:20:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\some-path\node_modules\tapable\lib\Hook.js:18:14)

Steps to Reproduce the Problem

  1. Setup project
"dependencies": {
    "@emotion/react": "11.13.3",
    "@emotion/styled": "11.13.0",
    "ts-loader": "9.5.1",
    "typescript": "5.6.3",
    ... 
  1. Re-Declare Theme interface
// emotion.d.ts
import '@emotion/react'

declare module '@emotion/react' {
  export interface Theme {
    colors: {
      black: string
      darkBlue: string
      darkGreen: string
      gray: string
      green: string
      lightGreen: string
      mediumGreen: string
      orange: string
      cyan: string
      magenta: string
      purple: string
      red: string
      yellow: string
      white: string
    }
  1. yarn run start

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions