Skip to content

Instantly share code, notes, and snippets.

View MariusBongarts's full-sized avatar

Marius Bongarts MariusBongarts

View GitHub Profile
class MyWebComponent extends HTMLElement {...}
window.customElements.define('my-web-component', MyWebComponent);
@MariusBongarts
MariusBongarts / README.md
Created August 8, 2023 06:39
My Github profile preview

Hey there, I'm Marius 👋

  • 💼 Frontend Engineer @ Accenture Song
@MariusBongarts
MariusBongarts / README.md-preview
Last active August 8, 2023 06:38
Github README profile
<h1 align="center">Hey there, I'm Marius 👋</h1>
<p align="center">
<img src="https://komarev.com/ghpvc/?username=MariusBongarts&label=Profile+Views" />
</p>
<img align='right' src="https://media.giphy.com/media/M9gbBd9nbDrOTu1Mqx/giphy.gif" width="230">
- 💼 Frontend Engineer @ Accenture Song
{
"compilerOptions": {
"target": "es2022",
"lib": ["es2022", "esnext.decorators", "dom"]
}
}
Symbol.metadata ??= Symbol("Symbol.metadata");
interface Context {
name: string;
metadata: Record<PropertyKey, unknown>;
}
function setMetadata(_target: any, context: Context) {
context.metadata[context.name] = true;
}
class SomeClass {
declare let array: string[] | number[];
array.filter(x => !!x);
// ~~~~~~ error!
// ❌ error before Typescript 5.2
type MixedTupleRest = [first: string, ...string[]];
// ✅ fixed with label
type MixedTupleRestFixed = [first: string, ...rest: string[]];
// ❌ error before Typescript 5.2
type MixedTuple = [first: string, string];
type UnlabeledTuple = [string, string];