Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
typed-path
Advanced tools
Types are lost when string paths are used in typescript.
I.e. _.get, _.map, _.set, R.pluck
from libraries like lodash, ramda.
It makes those methods dangerous in case of refactoring, the same as JavaScript.
With typed-path
typescript can check paths and warns you about errors.
Also you can get access to the path string using $path
special field. @m-abboud
Like this:
console.log(tp<TestType>().a.b.c.d.$path); // this will output "a.b.c.d"
If you need a raw path, which is of type string[]
- you can get it using $raw
special field. dcbrwn
console.log(tp<TestType>().a.b.c.d.$raw); // this will output ["a", "b", "c", "d"]
Also typed-path
allows typescript to suggest field names for you.
Copyright (c) 2017 Oleksandr Beshchuk <bs.alex.mail@gmail.com>
Licensed under the Apache License.
FAQs
Type safe object string paths for typescript.
The npm package typed-path receives a total of 3,390 weekly downloads. As such, typed-path popularity was classified as popular.
We found that typed-path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.