Comments (5)
I started with a repro like this: TS playground but I managed to reduce it even further (TS playground):
const createCacheReducer = <N extends string, QR>(
queries: Cache<N, QR>["queries"],
) => {
const queriesMap = {} as QR;
const initialState = {
queries: queriesMap,
};
return (state = initialState) => state;
};
export type Cache<N extends string, QR> = {
queries: {
[QK in keyof QR]: ReturnType<typeof createCacheReducer<QR>>;
};
};
from typescript.
"Probably caused by this code" is not exactly a repro case. Can you slim down ur repo to the required bits that lead to this bug?
from typescript.
@Andarist tried, but seems that almost all repo code is needed. Btw fixed it already by removing cycled typing, in the next commit.
Interesting that in prev commit cycles also existed but issue did not happen and everything worked, but after adding changes in that commit tsc
started crashing.
from typescript.
FYI Overall repo is the best example of very black TS magic thats required for proper typing in some cases.
And also would be great that we don't need as
in switch/case for generic literals:
// src/reducer.ts
switch (action.type) {
case actions.updateQueryStateAndEntities.type: {
const {
queryKey,
queryCacheKey,
state: queryState,
entityChagnes,
} = action as ReturnType<typeof actions.updateQueryStateAndEntities> // this line should be just `} = action`
from typescript.
This crashes when trying to serialize the type of this createCacheReducer
here:
https://github.com/gentlee/react-redux-cache/blob/ae4159b12ab02110874ffda5383ea8605b5601e7/src/types.ts#L46
FWIW, it errors because it can't find applicable signatures for this instantiation expression and it tries to report this error:
"Type '{0}' has no signatures for which the type argument list is applicable."
That leads to serializing this type in the first place.
from typescript.
Related Issues (20)
- TS 5.6 requires composite projects with noEmit to have fully accessible types, unlike 5.5 HOT 6
- useVsCodeWatcher interferes with updating typescript @aliased imports paths on file or folder moves HOT 2
- Switch typeguard for single case HOT 2
- `AutoFill` is missing a few valid tokens for the `autocomplete` attribute HOT 2
- Cannot read properties of undefined (reading 'charCount') HOT 1
- `tsBuildInfoFile` compiler option should be allowed without `incremental` or `composite` in Typescript versions `>5.6`
- super() typed as returning void HOT 2
- Move to File does not generate imports in the same way that autoimports does
- Move To File makes extra spaces when moving jsdoc comments
- (JSDoc, JavaScript) Imported class types by require() are unresolved HOT 1
- Type all exported members according to some interface HOT 2
- JSDoc typed function comments inside functions
- Error when accessing CSS property value using kebab case in `CSSStyleDeclaration` object HOT 1
- Type 'never' incorrectly inferred for mixed primitive type properties assignment with strictNullChecks disabled HOT 2
- Array of object unions not working as expected HOT 2
- Support WebIDL interfaces nominally (not just structurally) HOT 9
- Improve type inference for nullish coalescing (??) after null checks on multiple variables HOT 2
- [NewErrors] 5.7.0-dev.20240915 vs 5.6.2 HOT 6
- [ServerErrors][JavaScript] 5.7.0-dev.20240915 vs 5.6.2 HOT 3
- [ServerErrors][TypeScript] 5.7.0-dev.20240915 vs 5.6.2 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.