타입스크립트 네이티브 컴파일러

TypeScript native compiler

TypeScript 7은 컴파일러를 네이티브 코드로 옮겨 파일 분석을 병렬화합니다.

···
html
<div class="visual compiler" data-step="0"><div class="visual-head"><strong>NATIVE COMPILER</strong><i></i></div><div class="visual-scene"><div class="compile-row"><b>JS</b><div class="compile-track"><i>A</i><i>B</i><i>C</i></div></div><div class="compile-row"><b>Native</b><div class="compile-track"><i>A</i><i>B</i><i>C</i></div></div><div class="compile-out">same checked result</div></div><div class="visual-caption"></div><div class="visual-dots"><b></b><b></b><b></b></div></div>
css
.visual{width:min(95vw,760px);height:min(91vh,330px);padding:clamp(9px,2.5vmin,18px);display:flex;flex-direction:column;gap:clamp(6px,1.7vmin,11px);border:1px solid var(--line);border-radius:13px;background:var(--surface);font:500 clamp(12px,3.4vmin,16px)/1.25 var(--font-sans,-apple-system),sans-serif}
.visual-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:19px;color:var(--accent)}.visual-head strong{font-size:1em}.visual-head i{display:block;width:8px;height:8px;flex:none;border-radius:50%;background:var(--accent);animation:visual-pulse 1.3s infinite}@keyframes visual-pulse{50%{opacity:.25}}
.visual-scene{position:relative;flex:1;min-height:0;overflow:hidden}.visual-caption{min-height:2.4em;display:grid;place-items:center;text-align:center}.visual-dots{display:flex;justify-content:center;gap:4px}.visual-dots b{display:block;width:15px;height:3px;border-radius:3px;background:var(--line)}.visual-dots b.on{background:var(--accent)}
.visual-scene *{box-sizing:border-box}.visual-scene .mono{font-family:ui-monospace,monospace}.visual-scene .muted{color:var(--muted)}.visual-scene .lit{border-color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 14%,var(--surface))!important;color:var(--fg)!important}
.compiler .visual-scene{display:flex;flex-direction:column;justify-content:center;gap:12px}.compile-row{display:flex;align-items:center;gap:10px}.compile-row b{width:52px;flex:none;color:var(--muted)}.compile-track{display:flex;gap:5px;flex:1}.compile-track i{height:25px;flex:1;display:grid;place-items:center;border:1px solid var(--line);border-radius:5px;background:var(--bg);font:600 12px ui-monospace,monospace;transition:background .35s,transform .35s}.compiler[data-step="0"] .compile-row:first-child i:first-child,.compiler[data-step="1"] .compile-row:first-child i:nth-child(-n+2),.compiler[data-step="1"] .compile-row:nth-child(2) i,.compiler[data-step="2"] .compile-track i{background:var(--accent);color:var(--surface)}.compiler[data-step="1"] .compile-row:nth-child(2) i{transform:translateY(-4px)}.compile-out{text-align:center;color:var(--muted);opacity:.4;transition:opacity .3s}.compiler[data-step="2"] .compile-out{opacity:1;color:var(--accent)}
js
const root=document.querySelector('.visual'),cap=root.querySelector('.visual-caption'),dots=[...root.querySelectorAll('.visual-dots b')],captions=["Sequential file pass","Native workers share files","Checked result is the same"];let step=0;function advance(){root.dataset.step=String(step);cap.textContent=captions[step];dots.forEach((d,i)=>d.classList.toggle('on',i===step));if(root.classList.contains('generic')){root.querySelector('.generic-input').textContent=step===3?'"hi"':'7';root.querySelector('.generic-output').textContent=step===3?'"hi" : string':'7 : number'}if(root.classList.contains('union'))root.querySelector('.set-value').textContent=step%2?'value: "seven"':'value: 7';step=(step+1)%captions.length}advance();let timer=setInterval(advance,1100);root.addEventListener('pointerdown',()=>{clearInterval(timer);advance()})

TypeScript 7은 컴파일러와 언어 서비스를 Go 기반 네이티브 구현으로 옮겼습니다. 파싱·타입 검사·출력처럼 큰 단계가 진행되는 동안 여러 파일의 일을 나누어 처리할 수 있습니다.

데모의 두 레인은 같은 파일 묶음이 차례로 처리되는 모습과 분산 처리되는 모습을 개념적으로 비교합니다. 실제 속도는 프로젝트 크기와 머신에 따라 달라지므로, 그림의 칸 수를 성능 수치로 읽으면 안 됩니다.

언제 쓰나

큰 TypeScript 프로젝트의 편집기 응답과 타입 검사 시간을 줄일 때 살펴봅니다. 도구의 컴파일러 API 호환성도 확인하세요.

페이지로 열기 ↗