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
type Func = (par: number) => string; | |
function canBeParameter(func: Func) { | |
// do Something | |
} | |
function canReturn(): Func { | |
return (par) => par.toString(); | |
} |
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 hello(name) { | |
return `Hello, ${name}.`; | |
} | |
function main() { | |
const helloString = hello('Henry'); | |
console.log(helloString); | |
} | |
main(); |
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 someName = 'Henry'; | |
function hello() { | |
console.log(`Hello, ${someName}.`); | |
} |
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 Person { | |
readonly name: string; | |
readonly age: number; | |
} | |
function addAge(person: Person) { | |
const newPerson: Person = { | |
...person, | |
age: person.age + 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 Person { | |
name: string; | |
age: number; | |
} | |
function addAge(person: Person) { | |
person.age += 1; | |
return person; | |
} |
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
let globalVariable = 10; | |
const impureFunction = (x: number, y: number) => { | |
globalVariable = y; | |
return x + y; | |
}; | |
function main() { | |
console.log(impureFunction(1, 2)); // 3 | |
console.log(impureFunction(1, 2)); // 3 |
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
let globalVariable = 10; | |
const impureFunction = (x: number, y: number) => x + y + globalVariable; | |
function main() { | |
console.log(impureFunction(1, 2)); // 13 | |
globalVariable = 20; | |
console.log(impureFunction(1, 2)); // 23 | |
} |
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 pureFunction = (x: number, y: number) => x + y; |
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 { configure } from '@storybook/react'; | |
configure(require.context('../src', true, /\.stories\.js?$/), module); |
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
{ | |
"name": "RNStorybookWeb", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"android": "react-native run-android", | |
"ios": "react-native run-ios", | |
"storybook": "start-storybook -p 9001 -c .storybook -s .storybook/assets", // 추가 | |
"storybook:build": "build-storybook -c .storybook -s .storybook/assets", // 추가 | |
"start": "react-native start", |