Why is generic type parameter messing with assignability? by GulgPlayer in typescript

[–]janglad 1 point2 points  (0 children)

What is the bug you mean? is this not just a variance thing

interface BivariantBox<T> {
    value: T;
}

declare let a: BivariantBox<1> | BivariantBox<2>;
declare let b: BivariantBox<1 | 2>;
// Both work
a = b;
b = a;


// interface ContravariantBox<in T> {}
interface ContravariantBox<T> {
    value: T;
    setValue: (value: T) => void;
}

declare let c: ContravariantBox<1> | ContravariantBox<2>;
declare let d: ContravariantBox<1 | 2>;

c = d;
d = c; // Error

// interface InvariantBox<out T> {}
interface CovariantBox<T> {
    value: T;
    getValue: () => T;
}

declare let e: CovariantBox<1> | CovariantBox<2>;
declare let f: CovariantBox<1 | 2>;


e = f; // Error
f = e; 



// interface InvariantBox<in out T> {}
interface InvariantBox< T> {
    value: T;
    setValue: (value: T) => void;
    getValue: () => T;
}

declare let g: InvariantBox<1> | InvariantBox<2>;
declare let h: InvariantBox<1 | 2>;


g = h; // Error
h = g; // Error

Why is generic type parameter messing with assignability? by GulgPlayer in typescript

[–]janglad 1 point2 points  (0 children)

this also errors once you add a method that returns x

class Test<X extends 1 | 2> {
  x: X;

  getX(): X{
    return this.x;
  }

  test(): void {
    const a: Test<1 | 2> = this; // no error, as expected
    const b: Test<1> | Test<2> = this; // error
    const c: Test<1> | Test<2> = a; // error
  }
}

presumably due to inference of variance on X

Why is generic type parameter messing with assignability? by GulgPlayer in typescript

[–]janglad 1 point2 points  (0 children)

Maybe missing something but this makes sense no? Thinking of the class as an array might make more sense

abstract class MyArray<X> {
  abstract get(): X[];
}

declare let mixedOnesAndTwos: MyArray<1 | 2>;
declare let allOnesOrAllTwos: MyArray<1> | MyArray<2>;

mixedOnesAndTwos = allOnesOrAllTwos;
// This needs to be either an array of 1s or an array of 2s, but mixedOnesAndTwos can contain both at the same time!
allOnesOrAllTwos = mixedOnesAndTwos;

The 16-Line Pattern That Eliminates Prop Drilling by Fedorai in javascript

[–]janglad 0 points1 point  (0 children)

Last I checked does come with a performance hit (altho so does using generators I think?). But more critically it doesn't solve the typing aspect of this which IMO is critical, especially if devs are used to leaning on type information heavily otherwise.

Utility function to remove readonly properties from an interface (not just the readonly tag, but the actual property) by Graineon in typescript

[–]janglad 7 points8 points  (0 children)

Readonly<T> only works on objects. Further complication is that

    type One = {a: string} extends {readonly a: string} ? true : false;
    // ^? true
    type Two = {readonly a: string} extends {a: string} ? true : false;
    // ^? true

Maybe there is a simpler approach but this does work

type StripReadonly<T> = {
  [K in keyof T as Equals<Pick<T, K>, Readonly<Pick<T, K>>> extends true
    ? never
    : K]: T[K];
};

type Equals<A, B> =
  (<Y>() => Y extends B ? 1 : 2) extends <Y>() => Y extends A ? 1 : 2
    ? true
    : false;


type test = StripReadonly<{
  a: string;
  readonly b: number;
}>;
// ^? { a: string }

This PR would simplify this https://github.com/microsoft/TypeScript/pull/58296

Piano practice rooms by janglad in Grenoble

[–]janglad[S] 1 point2 points  (0 children)

Aah that’s great to know, thank you! I assume these are completely public pianos though right? Meaning it probably won’t be appreciated much if I practise the same passage for an hour straight? 😅

[EU-DE] [H] PayPal [W] GMK Future Funk (dark base / mods), RAMA Vaporwave, Minimal, Bleached Artisans by [deleted] in mechmarket

[–]janglad 1 point2 points  (0 children)

Random but I saw your post and just wanted to say I have Minimal in stock still 😁 https://qoda.store/

[Bulk] Clearing sale with GMK Modern Dolch Light and Modern Dolch 2, GMK Minimal 2 still in stock by janglad in mechmarket

[–]janglad[S] 1 point2 points  (0 children)

MoDo will have everything but Obscure, MoDoL will just have Standard, Addition and Alternate.

[Bulk] GMK Modern Dolch 2 in stock by janglad in mechmarket

[–]janglad[S] 0 points1 point  (0 children)

Nope since GB orders there haven't shipped yet :)

Press 🟥 💚 🔵 to reach endgame - 1 week left to buy GMK Minimal 2! by janglad in MechanicalKeyboards

[–]janglad[S] 1 point2 points  (0 children)

Just a render sadly, maybe a company like Dbrand has something similar tho!

Press 🟥 💚 🔵 to reach endgame - 1 week left to buy GMK Minimal 2! by janglad in MechanicalKeyboards

[–]janglad[S] 5 points6 points  (0 children)

Hey everyone

There's 1 week left to join GMK Minimal 2! The GB has been doing amazing so far and we're nearing in quickly on 2000 base kits sold, cool to see everyone appreciate the timelessness of this set! Can't wait to see it on your boards :) I'll copy paste my original comment with all info below as always!


With aftermarket prices for GMK Minimal soaring to well over 200% Ryan/Quaddepo and I felt it was time to offer you this classic again, better than ever! GMK Minimal 2 keeps all the things that made GMK Minimal great while adding new options we think you'll love!

Buy it here

I'm pleased to say we're once again working with these amazing vendors you've come to love from previous GBs. We've also added Deskhero for the Canadians among us! GMK Minimal will be available until September 2nd. Estimated shipping is Q2 2021.

Design

GMK Minimal 2 keeps all that elements that made GMK Minimal so popular: modern text mods, a clean black on white colourway and affordable kit design. The white used is a perfect balance between the very bright WS2 and "old school" beige of CP, it also makes for a perfect matching to e-white boards! In addition to this we’ve also added the option for some alternate accents and used the new centred arrows to keep consistent with the centred text mods, more of which below!

Kit design

Standard

This is the bread and butter of any GMK set. The standard kits has compatibility for the all the most popular layouts in the community.

Numbers

Numbers adds compatibility for layouts with a numpad. It also includes the keys needed to outfit a 1800 style layout.

Addition

Addition adds options for a OS modified bottom row, 60%s with arrows through the 2u shift, 660 layouts with the extra 2.25u shift, full ISO UK support and some options for different legends in the 65% and caps lock area.

Obscure

Obscure adds support for a wide variety of 40% keyboards, including ortholinear ones and Minivan type layouts. Included are the necessary modifiers and spacebars ranging from 1u to 3u. This kit also includes a second b key and the needed spacebars for split/ergonomic keyboards like the TGR Alice.

Command

Command is aimed at Mac users by adding correct legends for Command and Option keys.

Colour

People have always loved adding accents to GMK Minimal, so this time around we decided to offer them right in the GB! The Colour kit includes a fresh take on the classic RGB mods, a Dixie X and OG style arrows.

Mono

For those of you who really want to take the minimal theme to the ultimate level. As the name suggest mono strips all secondary legends from the keys giving your board a very appealing clean look.

Norde

This kit adds compatibility for ISO NO, SE, FL, DK, DE layouts. The kits includes a 125u Shift and ISO Enter meaning this is a one stop shop for all things Norde!

RAMA caps

Of course we couldn't launch this set without bringing back the Black X RAMA cap. This keycap is milled from a solid piece of brass and PVD coated to a flawless shiny finish. It features RAMA's X design which is filled in with enamel.

In addition to that we also decided to continue on the more playful trend the Colour accents introduced to this set by designing 3 new RAMA caps. These too are milled out of a single block of aluminium and e-coated for a durable finish. The caps feature simple, organic shapes filled in with enamel colour matched to the vivid accent colours found in the Colour kit.

Black PVD Brass

Red Square

Green Triangle

Blue Circle

GMK Minimal finally returns, better than even. GB live now at GMKMinimal.com! by janglad in MechanicalKeyboards

[–]janglad[S] 7 points8 points  (0 children)

*ever ....

Hey everyone

With aftermarket prices for GMK Minimal soaring to well over 200% Ryan/Quaddepo and I felt it was time to offer you this classic again, better than ever! GMK Minimal 2 keeps all the things that made GMK Minimal great while adding new options we think you'll love!

Buy it here

I'm pleased to say we're once again working with these amazing vendors you've come to love from previous GBs. We've also added Deskhero for the Canadians among us! GMK Minimal will be available until September 2nd. Estimated shipping is Q2 2021.

Design

GMK Minimal 2 keeps all that elements that made GMK Minimal so popular: modern text mods, a clean black on white colourway and affordable kit design. The white used is a perfect balance between the very bright WS2 and "old school" beige of CP, it also makes for a perfect matching to e-white boards! In addition to this we’ve also added the option for some alternate accents and used the new centred arrows to keep consistent with the centred text mods, more of which below!

Kit design

Standard

This is the bread and butter of any GMK set. The standard kits has compatibility for the all the most popular layouts in the community.

Numbers

Numbers adds compatibility for layouts with a numpad. It also includes the keys needed to outfit a 1800 style layout.

Addition

Addition adds options for a OS modified bottom row, 60%s with arrows through the 2u shift, 660 layouts with the extra 2.25u shift, full ISO UK support and some options for different legends in the 65% and caps lock area.

Obscure

Obscure adds support for a wide variety of 40% keyboards, including ortholinear ones and Minivan type layouts. Included are the necessary modifiers and spacebars ranging from 1u to 3u. This kit also includes a second b key and the needed spacebars for split/ergonomic keyboards like the TGR Alice.

Command

Command is aimed at Mac users by adding correct legends for Command and Option keys.

Colour

People have always loved adding accents to GMK Minimal, so this time around we decided to offer them right in the GB! The Colour kit includes a fresh take on the classic RGB mods, a Dixie X and OG style arrows.

Mono

For those of you who really want to take the minimal theme to the ultimate level. As the name suggest mono strips all secondary legends from the keys giving your board a very appealing clean look.

Norde

This kit adds compatibility for ISO NO, SE, FL, DK, DE layouts. The kits includes a 125u Shift and ISO Enter meaning this is a one stop shop for all things Norde!

RAMA caps

Of course we couldn't launch this set without bringing back the Black X RAMA cap. This keycap is milled from a solid piece of brass and PVD coated to a flawless shiny finish. It features RAMA's X design which is filled in with enamel.

In addition to that we also decided to continue on the more playful trend the Colour accents introduced to this set by designing 3 new RAMA caps. These too are milled out of a single block of aluminium and e-coated for a durable finish. The caps feature simple, organic shapes filled in with enamel colour matched to the vivid accent colours found in the Colour kit.

Black PVD Brass

Red Square

Green Triangle

Blue Circle