yortus / rtti Goto Github PK
View Code? Open in Web Editor NEWRuntime type information for JavaScript and TypeScript programs
Runtime type information for JavaScript and TypeScript programs
Source code in question: https://github.com/yortus/rtti/blob/main/src/operations/sanitize.ts#L30-L40
This current implementation works for simple intersections of objects, but not nested objects. It basically removes all properties of nested objects except those defined in the last member of the intersection.
To rectify this, it should do a 'deep' intersection of nested properties first, and then delegate to object sanitisation.
Code ref: https://github.com/yortus/rtti/blob/master/src/remove-excess-properties.ts#L32-L36
If t
contains members that are themselves intersections, then those intersections' members should also end up in combinedProps
, but with this code they don't. This means too many props get removed in some cases.
Need to flatten
intersections for the purposes of the removeExcessProperties
function.
Should check if this affects other functions too.
HI @yortus :)
We are using your other lib, http-schemas, that relies on rtti. We are using this in a browser SPA that relies on Webpack 5. Webpack 5 has stopped providing polyfils for some node based libraries like util
. Is it possible to change the requirement of this library away from using util
?
RR! Module not found: Error: Can't resolve 'util' in '/Users/ray/source/xxx/shared/http/node_modules/rtti/dist/commonjs'
ERR!
ERR! BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
ERR! This is no longer the case. Verify if you need this module and configure a polyfill for it.
ERR!
ERR! If you want to include a polyfill, you need to:
ERR! - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
ERR! - install 'util'
ERR! If you don't want to include a polyfill, you can use an empty module like this:
ERR! resolve.fallback: { "util": false }
ERR! ModuleNotFoundError: Module not found: Error: Can't resolve 'util' in '/Users/xxx/shared/http/node_modules/rtti/dist/commonjs'
ERR!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.