Skip to content

Instantly share code, notes, and snippets.

View akihisa-shimada's full-sized avatar

akihisa-shimada

View GitHub Profile
const fetcher = async(url: string): Promise<any> => {
const res = await fetch(url).then(res => res.json());
return res;
}
export const getUser = async(): Promise<any> => {
const user = await fetcher('https://example.com/api/user');
return user;
}
interface Lengthwise {
length: number;
}
function loggingIdentity<T>(arg: T): T {
console.log(arg.length);
// -> Property 'length' does not exist on type 'T'.(2339)
return arg;
}
function identity<T>(arg: T): T {
return arg;
}
console.log(identity<string>("string"));
console.log(identity(1));
interface Lengthwise {
length: number;
}
function loggingIdentity<T extends Lengthwise>(arg: T): T {
console.log(arg.length);
return arg;
}
loggingIdentity(['hello world'])
import { Helmet, HelmetProvider } from "react-helmet-async";
const faqSchema = {
"@context": "https://schema.org",
"@type": "FAQPage",
mainEntity: [
{
"@type": "Question",
name: "よくある質問",
acceptedAnswer: {