Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@finsemble/finsemble-ui
Advanced tools
The Finsemble UI API and assorted building blocks to make good looking, smooth running SmartDesktops.
any
type shall not be used whenever a more accurate type is known.any
. For example:function map(cb: (el: T1) => T2, array: T1[]): T2[] {
//...
}
function log(...args: any[]): void { ... }
For example:
// Incorrect example
const foo: Record = { bar: 7 };
foo.quux; // type is number, but value is undefined!
// Correct example
const foo: Record = { bar: 7 };
foo.quux; // type is (number | undefined), which is correct
Whenever Typescript cannot infer the correct type, you may use casting if you are absolutely sure of the correct type. For example, the following is allowed:
const foo: Record = {bar: 7}
const bar = Object.values(foo) as number[];
The following policies are experimental. Give them a shot - but if you find they can be improved, talk to the chief architect.
The guiding principle is that conditional business logic (anything with if
or switch
statement that depends on domain knowledge),
should have tests, because unit tests are an excellent development tool, aide in understanding the code, and can prevent regressions.
In general, conditional business logic should be relegated to the reducer functions; however, if this proves too difficult, exceptions
can be made in the hooks.
// Bad example - conditional code is mixed in with Finsemble service calls.
const useFoo = () => {
...
if(!state.foo.ignoreBar && state.foo.bar > state.baz) {
await FSBL.FooClient.doFoo(foo, "start")
} else {
await FSBL.FooClient.cancelFoo(foo);
}
...
}
// Better example - Conditional code is encapsultaed in pure function.
const doFoo (foo: Foo) => await FSBL.FooClient.doFoo(foo, "start");
const cancelFoo (foo: Foo) => await FSBL.FooClient.cancelFoo(foo);
// Because this is a pure function (returns a function reference but doesn't invoke),
// it's easily testable.
const decideFoo = (foo) => {
return (!state.foo.ignoreBar && state.foo.bar > state.baz)
? doFoo : cancelFoo;
}
const useFoo = () => {
...
decideFoo(foo)();
...
}
Dan Abramov's post on setTimeout and useRef https://overreacted.io/making-setinterval-declarative-with-react-hooks/
Dan Abramov's comments on React portals https://github.com/facebook/react/issues/12355#issuecomment-410996235
FAQs
This library has been deprecated and is being maintained for long term support. Finsemble's UI components can now be imported directly from @finsemble/finsemble-core. See https://documentation.finsemble.com/tutorial-UIComponents.html
The npm package @finsemble/finsemble-ui receives a total of 737 weekly downloads. As such, @finsemble/finsemble-ui popularity was classified as not popular.
We found that @finsemble/finsemble-ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.