Try aliasing preact typescript declaration to fix ts errors#11088
Merged
AbhiPrasad merged 4 commits intocl/screenshot-integrationfrom Mar 14, 2024
Merged
Try aliasing preact typescript declaration to fix ts errors#11088AbhiPrasad merged 4 commits intocl/screenshot-integrationfrom
AbhiPrasad merged 4 commits intocl/screenshot-integrationfrom
Conversation
ryan953
approved these changes
Mar 13, 2024
851fd44 to
38e4b97
Compare
Contributor
Author
|
nvm CI sucks I'll stay on this branch. |
38e4b97 to
470cc40
Compare
| walk(filePath); | ||
| } else { | ||
| if (filePath.endsWith('.d.ts')) { | ||
| const content = fs.readFileSync(filePath, 'utf8'); |
Check failure
Code scanning / CodeQL
Potential file system race condition
| const content = fs.readFileSync(filePath, 'utf8'); | ||
| if (preactImportRegex.test(content)) { | ||
| const newContent = content.replace(preactImportRegex, '// replaced import from preact'); | ||
| fs.writeFileSync(filePath, snippet + newContent, 'utf8'); |
Check failure
Code scanning / CodeQL
Potential file system race condition
AbhiPrasad
commented
Mar 14, 2024
| const content = fs.readFileSync(filePath, 'utf8'); | ||
| const capture = preactImportRegex.exec(content); | ||
| if (capture) { | ||
| const groups = capture[1].split(',').map(s => s.trim()); |
Contributor
Author
There was a problem hiding this comment.
shrewd readers would notice that this breaks completely with multiline imports
import {
x,
y,
z,
} from 'preact';
I know, but we can cross that bridge when we come to it - prefer to get this out to unblock asap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
attempting to unblock #10590
Right now the feedback PR fails ts3.8 e2e tests: https://github.com/getsentry/sentry-javascript/actions/runs/8268834386/job/22630054663?pr=10590
This is because of TS issues, preact types do not work well with older TS types:
Essentially these types don't work on older versions and because the feedback package is depended on by the browser package, we will break a certain set of our users. We have to fix this before we can ship because of the browser package dependency.
To get around this, we do a workaround with
packages/feedback/scripts/shim-preact-export.js. Essentially we shim the preact type in our exports, which should change what the declaration files themselves point to. So something like the following:turns into