This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function identity<T>(arg: T): T { | |
return arg; | |
} | |
console.log(identity<string>("string")); | |
console.log(identity(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Lengthwise { | |
length: number; | |
} | |
function loggingIdentity<T extends Lengthwise>(arg: T): T { | |
console.log(arg.length); | |
return arg; | |
} | |
loggingIdentity(['hello world']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Helmet, HelmetProvider } from "react-helmet-async"; | |
const faqSchema = { | |
"@context": "https://schema.org", | |
"@type": "FAQPage", | |
mainEntity: [ | |
{ | |
"@type": "Question", | |
name: "よくある質問", | |
acceptedAnswer: { |
NewerOlder