上一页 1 ··· 72 73 74 75 76 77 78 79 80 ··· 497 下一页
摘要: // Imagine NavBar is an external library! export const NavBar = (props: { title: string; links: string[]; children: React.ReactNode; }) => { return <d 阅读全文
posted @ 2023-05-22 14:11 Zhentiw 阅读(18) 评论(0) 推荐(0)
摘要: Using Omit import { ComponentProps } from 'react'; import { Equal, Expect } from '../helpers/type-utils'; export const Input = ( props: Omit<Component 阅读全文
posted @ 2023-05-22 13:58 Zhentiw 阅读(56) 评论(0) 推荐(0)
摘要: Relevant for components that accept other React components as props. export declare interface AppProps { children?: React.ReactNode; // best, accepts 阅读全文
posted @ 2023-05-22 13:24 Zhentiw 阅读(40) 评论(0) 推荐(0)
摘要: fn multiply(num: Option<usize>) -> usize { return num.unwrap_or(0) * 5; } fn multiply1(num: Option<usize>) -> Option<usize> { match num { Some(num) => 阅读全文
posted @ 2023-05-18 20:32 Zhentiw 阅读(33) 评论(0) 推荐(0)
摘要: enum Color { Red, Green, Blue, Yellow, } impl Color { fn is_green(&self) -> bool { if let Color::Green = self { return true; } return false; } fn is_g 阅读全文
posted @ 2023-05-17 14:53 Zhentiw 阅读(40) 评论(0) 推荐(0)
摘要: Typescript import * as fs from "fs"; fs.readFileSync("project/lines", { encoding: "utf-8" }) .toString() .split("\n") .filter((_, i) => i % 2 0) .filt 阅读全文
posted @ 2023-05-16 14:34 Zhentiw 阅读(28) 评论(0) 推荐(0)
摘要: String collect: automaticlly calling concat on string let foo: String = vec!["this", "is", "a", "test"] .into_iter() .collect(); println!("{:?}", foo) 阅读全文
posted @ 2023-05-15 15:01 Zhentiw 阅读(96) 评论(0) 推荐(0)
摘要: docker exec container-id sh -c "patch -p1 < your-file.diff" Replace container-id with the ID of the container you want to run the command in, and your 阅读全文
posted @ 2023-05-10 22:53 Zhentiw 阅读(31) 评论(0) 推荐(0)
摘要: Few intertesting things from Rust Option<T>: with Some, unwrap() function todo(): to skil compiler error for a while unreachable(): similar to Typescr 阅读全文
posted @ 2023-05-09 01:03 Zhentiw 阅读(74) 评论(0) 推荐(0)
摘要: 1. TSD: https://github.com/SamVerschueren/tsd import {expectType} from 'tsd'; import concat from '.'; expectType<string>(concat('foo', 'bar')); expect 阅读全文
posted @ 2023-05-07 16:08 Zhentiw 阅读(46) 评论(0) 推荐(0)
上一页 1 ··· 72 73 74 75 76 77 78 79 80 ··· 497 下一页