Month: 2020-07


mrorz 11:06:45
遇到一個 Typescript 不知道怎麼 type 的狀況。

我寫了一個 controlled input,能吃比較寬鬆的 option value,然後再寫一個 wrapper 使用前述的 input,但它的值比較特定。

雖然 value prop 的部分可以過(嚴格的 type 可以 assignable to 寬鬆的 type),但比較嚴格的 `onChange`  就會觸發 type error。

Playground link 請點我



Kevin Hsu 10:17:02
@mattandkevin1060 has joined the channel


mofas 11:03:29


10 modern layouts in 1 line of CSS

雖然只有一行或一列、用 flexbox 也可以處理
但因為 grid 有 template 所以可以在 parent container 操控各個 row / column 的 layout 細節,不像 flexbox 這類操作必須要下在 flex item 上
2 2


jihchi 09:09:16
does this help for organization pages?
Dunno 🤷‍♂️


mofas 05:24:24
mofas 05:25:12
用text generator 已經可以gen 出react component不稀奇
mofas 05:25:22
可以gen 出Q&A 的答案
mrorz 16:39:46
(Expected) error handling on GraphQL using union types

2. 我自己現在的 Graphql mutation 結果設計是用前 <|medium> 的設計延伸的,所有的操作不是權限跟 input 格式問題的話,都統一回傳 &lt;Mutation&gt;Result 。 Result 是 錯誤 Type 跟 成功結果的 union。 ```Type Reply {...} interface UserError { message: String! } Type IsBlockedError extend UserError { message: String! // other props you want to show } union UpdateReplyResult = Reply | IsBlockedError Mutation { updateReply(input: UpdateReplyInput!): UpdateReplyResult! }```


jihchi 21:13:58

Monads, Explained Without Bullshit

there’s a CS theory term, “monad,” that has a reputation among extremely online programmers as being a really difficult to understand concept that nobody knows how to actually explain. for a while, i thought that reputation was accurate; i tried like six times to understand what a monad is, and couldn’t get anywhere. but then a friend sent me Philip Wadler’s 1992 paper “Monads for functional programming” which turns out to be a really good explanation of what a monad is (in addition to a bunch of other stuff i don’t care about). so i’m gonna be repackaging the parts i like of that explanation here.