feat: add JSDoc type-checking and declaration emission#1312
Open
alexander-akait wants to merge 1 commit into
Open
feat: add JSDoc type-checking and declaration emission#1312alexander-akait wants to merge 1 commit into
alexander-akait wants to merge 1 commit into
Conversation
|
a283064 to
21cd4a9
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1312 +/- ##
==========================================
+ Coverage 94.13% 94.39% +0.26%
==========================================
Files 3 3
Lines 409 428 +19
Branches 154 162 +8
==========================================
+ Hits 385 404 +19
Misses 22 22
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Mirror the JSDoc + tsc setup used in webpack/webpack-dev-middleware so
sass-loader can be type-checked from JSDoc and ship .d.ts declarations.
- tsconfig.json (allowJs, checkJs, strict, declaration, emitDeclarationOnly)
writes to ./types
- lint:types (tsc --noEmit) and build:types scripts; build runs build:code
and build:types in parallel; clean removes types
- @types/node devDependency, types/index.d.ts entry point
- Replace the previous Sass / SassEmbedded ambient typedefs with structural
ones (SourceLocation, SourceSpan, LoggerWarnOptions, Logger, CompileResult,
ModernImporter, AsyncCompiler, SassImplementation) so the emitted .d.ts
has no `import("sass")` / `import("sass-embedded")` references and end
users with either peer dep installed get clean types
- SassOptions is parameterised by @template T extends SassImplementation and
derives the options shape from T's compileStringAsync signature -- no
manual property enumeration
- getSassOptions, getWebpackResolver, getModernWebpackImporter, getCompileFn
are generic on T so the implementation type flows through without
package-specific imports
- Adapt to the post-legacy / post-node-sass main: only modern + modern-
compiler API paths remain (no LegacyImporter, LegacyResult,
LegacyImporterResult, LegacyImporterThis, proxyCustomImporters, render
branch, nodeSassJobQueue, or neo-async typings)
Verified: all four lint scripts pass, build:types emits clean .d.ts with no
real `import("sass")` references, and existing jest suites still pass.
https://claude.ai/code/session_01UgvxAaf3W9xymtJRAyk7QB
21cd4a9 to
904ba17
Compare
|
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.
Mirror the JSDoc + tsc pattern used in webpack/webpack-dev-middleware so
sass-loader can be type-checked from JSDoc and ship .d.ts declarations.
emitDeclarationOnly) writing to ./types
build:code and build:types in parallel; clean removes types
Resolver, ResolutionMap, SassCompileFunction, RawSourceMap, SassError,
EXPECTED_ANY) and tighten parameter/return types in src/index.js and
src/utils.js so tsc --strict passes
https://claude.ai/code/session_01UgvxAaf3W9xymtJRAyk7QB