Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Nuxt.js in TypeScript
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
nunulk
January 17, 2019
Programming
460
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Nuxt.js in TypeScript
やってみた
nunulk
January 17, 2019
More Decks by nunulk
See All by nunulk
Laravelでテストしやすいコードを書く5 / 5 tips of building testable modules in Laravel
nunulk
0
350
Design It! in a nutshell
nunulk
1
310
PHP Getting Faster
nunulk
0
290
How does learning English broaden your world?
nunulk
0
420
Testing on Laravel
nunulk
1
1.6k
Vue.js + TypeScript + Firebase
nunulk
0
970
A startup meets Laravel + Vue.js
nunulk
1
2.1k
Unit Testing Laravel
nunulk
0
520
A Third-rate Programmer Talked about a Survival Strategy for Software Engineers
nunulk
3
610
Other Decks in Programming
See All in Programming
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
160
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.5k
ジョジョの世界をXRで再現する
mofurune
0
130
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
7.5k
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.9k
最近”作らせてる” ローカルAIアプリの話
akit37
0
110
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
260
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
350
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
140
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
200
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
460
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
450
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Embracing the Ebb and Flow
colly
88
5.2k
Evolving SEO for Evolving Search Engines
ryanjones
0
310
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Balancing Empowerment & Direction
lara
6
1.3k
GraphQLとの向き合い方2022年版
quramy
50
15k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
390
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
270
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
790
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
250
Transcript
Nuxt.js in TypeScript ͬͯΈͨ nunulk ΒΒͼΎ͏ʮͬͯΈͨʯറΓͷLTେձ
ࣗݾհ const name: Name = 'nunulk(͵͵Δ͘)' let job: Job
= 'ϑϦʔϥϯεͷΣϒΞϓϦέʔγϣϯΤϯδχΞ' let languages: Language[] = [ 'C/C++', ‘Java', 'PHP', ‘JavaScript', ‘TypeScript’, ] let frameworks: Framework[] = [ 'CodeIgniter', 'Symfony', 'CakePHP', ‘Laravel', ]
ຊ͢͜ͱ • Nuxt.js ͱ TypeScript ͷհ • Nuxt.js ͷ TypeScript
ରԠঢ়گ • Nuxt.js Λ TypeScript Ͱಈ͔ͯ͠ΈΔ
Nuxt.js, TypeScript ͷհ
Nuxt.js ͱ “Nuxt.js Vue ΞϓϦέʔγϣϯΛ࡞͢ΔϑϨʔϜϫʔ ΫͰ͢ɻϢχόʔαϧΞϓϦέʔγϣϯɺ੩తʹੜ͞Ε ΔΞϓϦέʔγϣϯɺγϯάϧϖʔδΞϓϦέʔγϣϯͷ த͔Β࡞͢ΔΞϓϦέʔγϣϯΛબͿ͜ͱ͕Ͱ͖·͢ɻ” -
͡Ίʹ - Nuxt.js
Nuxt.js ͱ “Nuxt.js Vue ΞϓϦέʔγϣϯΛ࡞͢ΔϑϨʔϜϫʔ ΫͰ͢ɻϢχόʔαϧΞϓϦέʔγϣϯɺ੩తʹੜ͞Ε ΔΞϓϦέʔγϣϯɺγϯάϧϖʔδΞϓϦέʔγϣϯͷ த͔Β࡞͢ΔΞϓϦέʔγϣϯΛબͿ͜ͱ͕Ͱ͖·͢ɻ” -
͡Ίʹ - Nuxt.js
Nuxt.js ͱ “Nuxt.js Vue ΞϓϦέʔγϣϯΛ࡞͢ΔϑϨʔϜϫʔ ΫͰ͢ɻϢχόʔαϧΞϓϦέʔγϣϯɺ੩తʹੜ͞Ε ΔΞϓϦέʔγϣϯɺγϯάϧϖʔδΞϓϦέʔγϣϯͷ த͔Β࡞͢ΔΞϓϦέʔγϣϯΛબͿ͜ͱ͕Ͱ͖·͢ɻ” -
͡Ίʹ - Nuxt.js
Nuxt.js ͱ • vue, vuex, vue-router, vue-server-renderer, vue-meta શ෦ೖΓ •
ϧʔςΟϯάͷࣗಈԽɺmiddleware • Vue ίϯϙʔωϯτͱ Vuex Store ͷ࣮ʹઐ೦ Ͱ͖Δ
TypeScript ͱ “TypeScript ϚΠΫϩιϑτʹΑͬͯ։ൃ͞Εɺϝϯςφϯε ͞Ε͍ͯΔϑϦʔͰΦʔϓϯιʔεͷϓϩάϥϛϯάݴޠͰ͋Δɻ TypeScriptJavaScriptʹରͯ͠ɺলུՄೳͳ੩తܕ͚ͱΫ ϥεϕʔεΦϒδΣΫτࢦΛՃ͑ͨݫີͳεʔύʔηοτͱͳͬ ͍ͯΔɻ” - Wikipedia
TypeScript ͱ “TypeScript ϚΠΫϩιϑτʹΑͬͯ։ൃ͞Εɺϝϯςφϯε ͞Ε͍ͯΔϑϦʔͰΦʔϓϯιʔεͷϓϩάϥϛϯάݴޠͰ͋Δɻ TypeScriptJavaScriptʹରͯ͠ɺলུՄೳͳ੩తܕ͚ͱΫ ϥεϕʔεΦϒδΣΫτࢦΛՃ͑ͨݫີͳεʔύʔηοτͱͳͬ ͍ͯΔɻ” - Wikipedia
TypeScript ͱ let t: [string, number] = ['Jan', 1] enum
Color { Red, Green, Blue } const c: Color = Color.Green interface Food { name: string calories: number } class Menu { items: string[] pages: number constructor(items: string[], pages: number) { this.items = items this.pages = pages } }
Nuxt.js ͷ TypeScript ରԠঢ়گ
Template
Packages • nuxt-property-decorator: vue-class- component ͷϥούʔ • vuex-class: vuex ؔ࿈ͷܕఆٛ
• axios: ඇಉظHTTP௨৴
Nuxt.js Λ TypeScript Ͱಈ͔ͯ͠ΈΔ
υϝΠϯͷܕͱ RootState ͷఆٛ export interface Task { title: string;
status: TaskStatus; } export enum TaskStatus { Open = 'open', Doing = 'doing', Closed = 'closed', } export interface RootState { tasks: Task[]; }
Vue, Decorator ͷ import <script lang="ts"> import { Vue,
Component, Prop } from 'nuxt-property-decorator' @Component({}) export default class extends Vue { @Prop() value: Task }
Store ͷ࣮ export const state = (): RootState => ({
tasks: [], }) export const mutations: MutationTree<RootState> = { setTasks(state: RootState, tasks: Task[]): void { state.tasks = tasks }, addTask(state: RootState, task: Task): void { state.tasks.push({...task}) }, } export const actions: ActionTree<RootState, RootState> = { async fetchTasks({ commit }) { const tasks: Task[] = await api.fetchTasks() commit("setTasks", tasks) } }