TypeScript 6 modern defaults

타입스크립트 6 최신 기본값

New projects receive defaults oriented toward modern runtimes and modules.

···
html
<div class="visual defaults" data-step="0"><div class="visual-head"><strong>MODERN DEFAULTS</strong><i></i></div><div class="visual-scene"><div class="config-file mono">tsconfig.json<br><span>{ }</span></div><div class="config-arrow">→</div><div class="config-rules"><div>target <b>modern</b></div><div>module <b>modern</b></div><div>strict <b>on</b></div></div></div><div class="visual-caption"></div><div class="visual-dots"><b></b><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}
.defaults .visual-scene{display:flex;align-items:center;justify-content:center;gap:9px}.config-file{border:1px solid var(--line);border-radius:7px;background:var(--bg);padding:12px 8px;text-align:center}.config-file span{color:var(--muted)}.config-arrow{color:var(--accent);font-size:22px}.config-rules{display:flex;flex-direction:column;gap:4px;min-width:45%}.config-rules div{display:flex;justify-content:space-between;gap:5px;border:1px solid var(--line);border-radius:5px;padding:3px;background:var(--bg);transition:background .3s}.config-rules b{color:var(--accent)}.defaults[data-step="0"] .config-file,.defaults[data-step="1"] .config-rules div:first-child,.defaults[data-step="2"] .config-rules div:nth-child(2),.defaults[data-step="3"] .config-rules div:last-child{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 13%,var(--surface))}
js
const root=document.querySelector('.visual'),cap=root.querySelector('.visual-caption'),dots=[...root.querySelectorAll('.visual-dots b')],captions=["Sparse configuration","Target inherits a new default","Module inherits a new default","Pin options when needed"];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 6 changes several compiler defaults that previously targeted older environments. A project with sparse configuration may therefore see different checks or emit behavior after upgrading.

The demo contrasts inherited defaults with explicitly pinned settings. Review tsconfig and the requirements of dependencies during migration.

When to use

Use this when upgrading TypeScript or starting a tsconfig to audit behavior inherited from defaults.

Open as page ↗