Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the tsconfig option useDefineForClassFields and fix relevant TS files #2419

Open
Goodwine opened this issue Oct 29, 2024 · 1 comment · May be fixed by #2447
Open

Remove the tsconfig option useDefineForClassFields and fix relevant TS files #2419

Goodwine opened this issue Oct 29, 2024 · 1 comment · May be fixed by #2447
Assignees

Comments

@Goodwine
Copy link
Member

The recent update on gts included new settings for tsconfig.json. Specifically, it turned on useDefineForClassFields. And this changes the Typescript behavior in how/when class properties get initialized.

Related: microsoft/TypeScript#45995 (comment)

The task for this Issue with regards to sass-parser is to find all properties initialized with !, and replace them with a declare statement, for example:

class X {
  // BAD:
  _foo!: string;
}
class X {
  // GOOD:
  declare _foo: string;
}

Otherwise, the observed behavior for our PostCSS subnode classes is that all the values get reset after they get initialized to their "default" values.

@Goodwine
Copy link
Member Author

some properties may be defined with ? instead of !. So I guess the thing to do here is to check everything thoroughly

Goodwine added a commit that referenced this issue Nov 28, 2024
Fixes #2419

Turning off this TS compiler option is deprecated, and it will be removed "soon". It's annoying.. but oh well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant