#frontend-tech
2020-07-01
mrorz
11:06:45
遇到一個 Typescript 不知道怎麼 type 的狀況。
我寫了一個 controlled input,能吃比較寬鬆的 option value,然後再寫一個 wrapper 使用前述的 input,但它的值比較特定。
雖然 value prop 的部分可以過(嚴格的 type 可以 assignable to 寬鬆的 type),但比較嚴格的 `onChange` 就會觸發 type error。
Playground link 請點我。
不知道有沒有什麼好解法呢?
我寫了一個 controlled input,能吃比較寬鬆的 option value,然後再寫一個 wrapper 使用前述的 input,但它的值比較特定。
雖然 value prop 的部分可以過(嚴格的 type 可以 assignable to 寬鬆的 type),但比較嚴格的 `onChange` 就會觸發 type error。
Playground link 請點我。
不知道有沒有什麼好解法呢?
mrorz
2020-07-01 11:38:13
mrorz
11:38:13
2020-07-06
Kevin Hsu
10:17:02
@mattandkevin1060 has joined the channel
2020-07-07
mofas
11:03:29
2
2
mrorz
2020-07-07 11:24:04
前幾個很有趣
雖然只有一行或一列、用 flexbox 也可以處理
但因為 grid 有 template 所以可以在 parent container 操控各個 row / column 的 layout 細節,不像 flexbox 這類操作必須要下在 flex item 上
雖然只有一行或一列、用 flexbox 也可以處理
但因為 grid 有 template 所以可以在 parent container 操控各個 row / column 的 layout 細節,不像 flexbox 這類操作必須要下在 flex item 上
jihchi
2020-07-07 18:15:07
https://1linelayouts.glitch.me/ website
mrorz
11:24:04
前幾個很有趣
雖然只有一行或一列、用 flexbox 也可以處理
但因為 grid 有 template 所以可以在 parent container 操控各個 row / column 的 layout 細節,不像 flexbox 這類操作必須要下在 flex item 上
雖然只有一行或一列、用 flexbox 也可以處理
但因為 grid 有 template 所以可以在 parent container 操控各個 row / column 的 layout 細節,不像 flexbox 這類操作必須要下在 flex item 上
jihchi
18:15:07
https://1linelayouts.glitch.me/ website
2020-07-10
jihchi
09:09:16
1
mrorz
2020-07-10 10:51:02
does this help for organization pages?
jihchi
2020-07-10 11:27:43
Dunno 🤷♂️
mrorz
10:51:02
does this help for organization pages?
jihchi
11:27:43
Dunno 🤷♂️
2020-07-13
mofas
05:24:24
Holy.
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
Lkiral7903
2. 我自己現在的 Graphql mutation 結果設計是用前 medium 的設計延伸的,所有的操作不是權限跟 input 格式問題的話,都統一回傳 <Mutation>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!
}```
- Forwarded from #cofacts
- 2020-07-12 20:27:15
2020-07-21
jihchi
21:13:58
boringcactus.com
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.