Pathway to getting rid of hand-crafted .d.ts files#7402
Closed
fgnass wants to merge 28 commits intodecaporg:mainfrom
Closed
Pathway to getting rid of hand-crafted .d.ts files#7402fgnass wants to merge 28 commits intodecaporg:mainfrom
fgnass wants to merge 28 commits intodecaporg:mainfrom
Conversation
eoneill
reviewed
Feb 12, 2025
| import { connect } from 'react-redux'; | ||
| import { encodeEntry } from 'decap-cms-lib-util/src/stega'; | ||
|
|
||
| import { encodeEntry } from '../../../lib/stega'; |
There was a problem hiding this comment.
Thanks, this will fix #7401!
One thing might be worth doing is to add an alias to each tsconfig.json, e.g.
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}then here you can use the alias path...
import { encodeEntry } from '@/lib/stega';Personally, I find this easier to rationalize the file structure, when importing higher up the tree. This is definitely not required, but something to consider.
Thanks again for your awesome contributions!
Contributor
Author
1 task
This was referenced Feb 24, 2025
Contributor
Author
|
Closing this in favor of #7411 |
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.
This PR addresses type-related issues discussed in #4987 and paves the way to a more type-safe codebase.
What this PR does
"build:esm"script of each package now emits TypeScript declarations indist/esm. It does this by running babel and tsc in parallel."types"field that points todist/esm/index.d.ts🎉tsconfig.jsonfile that extends a common base. This allows us to use proper project references instead of treating everything as one big project.stega.tswas in the wrong package) and adds missing types for thesemaphorenpm package.What this PR does not do
This PR does not change any of the handwritten types defined in
decap-cms-core. It only converts the/index.d.tsfile intosrc/types/index.ts.Moving forward from here
The plan is to create a follow-up PR (once the new system is in place) that will replace the handwritten public types with the internal ones. With this PR as foundation, it will also be much easier to gradually convert more and more
.jsfiles into.tsfiles.I would love to hear your feedback and if you think that this is the right way to tackle this.