-
-
Notifications
You must be signed in to change notification settings - Fork 913
Closed
Labels
BugSomething isn't working.Something isn't working.TypeScriptIssue involves or relates to TypeScript.Issue involves or relates to TypeScript.
Description
Description
When using objectValues()
and omit()
with my typescript application, I lose type inference. I would like to use omit on parts in this function:
const addressPartsRemover = (source: string, parts: AddressParts) =>
Object.values(parts).reduce((acc, part) => acc.replace(part, ''), source);
But then I can not infer types and have to do things such as:
(Object.values(omit(parts, 'house')) as string[]).reduce((acc, part) => acc.replace(part, ''), source);
(objectValues(parts) as string[]).reduce((acc, part) => acc.replace(part, ''), source);
I tired explicitly installing the the types package and added it to my compiler options:
{
"compilerOptions": {
"typeRoots": [ "./node_modules/@stdlib/types" ],
},
}
Related Issues
There's a few type related issues and PRs but I don't think they are related.
Questions
User error? Am I suppose to do something else to use with TypeScript.
Demo
No response
Reproduction
No response
Expected Results
No response
Actual Results
No response
Version
"@stdlib/stdlib": "^0.0.96", "@stdlib/types": "^0.0.14",
Environments
Node.js
Browser Version
No response
Node.js / npm Version
18
Platform
GNU/Linux
Checklist
- Read and understood the Code of Conduct.
- Searched for existing issues and pull requests.
Metadata
Metadata
Assignees
Labels
BugSomething isn't working.Something isn't working.TypeScriptIssue involves or relates to TypeScript.Issue involves or relates to TypeScript.