Microsoft�A�v���O���~���O����uTypeScript 3.9�v�����J�F���x�A�@�\�A�g�����肪����

Microsoft�́A�I�[�v���\�[�X�̃v���O���~���O����̍ŐV�ŁuTypeScript 3.9�v�����J�����B�R���p�C���̍�������G�f�B�^�@�\�̋����A�R�[�f�B���O�x���Ȃǂ̉��ǂ��s���Ă���B

» 2020�N06��05�� 16��30�� ���J
[��IT]

���̋L���͉������ł��B����o�^�i�����j����ƑS�Ă������������܂��B

�@Microsoft��2020�N5��12���i�č����ԁj�A�I�[�v���\�[�X�̃v���O���~���O����̍ŐV�ŁuTypeScript 3.9�v�����J�����B

�@TypeScript�́A�ÓI�^�t�����ł��錾��ŁAJavaScript�̃X�[�p�[�Z�b�g���BECMA�K�i�ɏ]�����ŐV��JavaScript�̋@�\���A�Â�Web�u���E�U�⃉���^�C����������悤�ɃR���p�C�����邱�Ƃ��ł���B

�@TypeScript 3.9�́ANuGet���g�����A���̃R�}���h���C���̂悤�ɁAnpm���g���ăC���X�g�[���ł���B

npm install typescript

�@TypeScript 3.9�́uVisual Studio 2019�v�uVisual Studio 2017�v�̑��A�uVisual Studio Code�v�ƁuSublime Text�v�ł����p�ł���BTypeScript 3.9�̎�ȓ����͎��̒ʂ�B

���_��Promise.all�̉���

�@TypeScript�̍ŋ߂̃o�[�W�����i3.7�Ȃǁj�ł́A�uPromise.all�v��uPromise.race�v�̂悤�Ȋ֐��̐錾���X�V���ꂽ�B�����A����ɔ����Ċ�‚��̕���p���������B���ɁAnull�܂���undefined�̒l��g�ݍ��킹���ꍇ�������������B

interface Lion {
    roar(): void
}
interface Seal {
    singKissFromARose(): void
}
async function visitZoo(lionExhibit: Promise<Lion>, sealExhibit: Promise<Seal | undefined>) {
    let [lion, seal] = await Promise.all([lionExhibit, sealExhibit]);
    lion.roar(); // uh oh
//  ~~~~
// Object is possibly 'undefined'.
}

�@����͊�ȋ������BsealExhibit��undefined���܂ނ��ƂŁAlion�̌^��undefined���܂܂�Ă��܂��Ă���B

�@TypeScript 3.9�ł́A���_�v���Z�X�̉��ǂɂ���Ă��̖�肪�������ꂽ�B��̂悤�ȃG���[�͔������Ȃ��Ȃ��Ă���B

���x�̉��P

�@TypeScript 3.9�ł́A���x�̉��P�������s��ꂽ�B�umaterial-ui�v��ustyled-components�v�̂悤�ȃp�b�P�[�W�ŕҏW�^�R���p�C�����ɂ߂Ēx�����Ƃ������������߁ATypeScript�`�[���̓p�t�H�[�}���X����ɏd�_�I�Ɏ��g�񂾁B�傫�Ȍ����A�����A�����^�A�}�b�v�^�Ɋւ���肪�������̃P�[�X���œK�������A�̃v�����N�G�X�g�ɂ��A���ݍ��񂾉��P��}�����B

�@�e�v�����N�G�X�g�́A����̃R�[�h�x�[�X�̃R���p�C�����Ԃ�5�`10�����x�Z�k����B�S�̂Ƃ��āAmaterial-ui-styles�v���W�F�N�g�̃R���p�C�����Ԃ�25�����x�Z�k���ꂽ�ƁATypeScript�`�[���͍l���Ă���B

�@�G�f�B�^�ɂ��t�@�C�����ύX�Ɏ��Ԃ�������ꍇ�����������A���̖����������ꂽ�B

//@ts-expect-error�R�����g

�@�Ⴆ�΁ATypeScript�Ń��C�u�������쐬���Ă��āA�p�u���b�NAPI�̈ꕔ�Ƃ��āA�udoStuff�v�Ƃ����֐����G�N�X�|�[�g����Ƃ���B���̊֐��̌^�́A����TypeScript���[�U�[���^�`�F�b�N�G���[���擾�ł���悤�ɁA2�‚̕���������Ɛ錾���邪�AJavaScript���[�U�[�ɗL�p�ȃG���[���o�͂��邽�߁A�����^�C���`�F�b�N���s���i�J���r���h�ɂ����Ă݂̂�������Ȃ��j�B

function doStuff(abc: string, xyz: string) {
    assert(typeof abc === "string");
    assert(typeof xyz === "string");
    // do some stuff
}

�@���̂��߁ATypeScript���[�U�[�͂��̊֐�����p����ƁA�L�p�ȐԂ��`���_�ƃG���[���b�Z�[�W���擾����BJavaScript���[�U�[���A�T�[�V�����G���[���擾����B���̋������e�X�g���邽�߁A���j�b�g�e�X�g���쐬����B

expect(() => {
    doStuff(123, 456);
}).toThrow();

�@�c�O�Ȃ���A�e�X�g��TypeScript�ō쐬����ƁATypeScript�̓G���[��񋟂���B

    doStuff(123, 456);
//          ~~~
// error: Type 'number' is not assignable to type 'string'.

�@���̂��߁ATypeScript 3.9�ł́A�u// @ts-expect-error�v�R�����g�Ƃ����V�@�\���������ꂽ�B�s�̑O��// @ts-expect-error�Ƃ����R�����g��z�u����ƁATypeScript�́A���������G���[�̕񍐂�}������B�����A�G���[���Ȃ��ꍇ�́A// @ts-expect-error���s�v�������ƕ񍐂���B

�@�ȒP�ȗ�ł����΁A���̃R�[�h�͖��Ȃ��B

// @ts-expect-error
console.log(47 * "octopus");

�@�����A���̃R�[�h�́A

// @ts-expect-error
console.log(1 + 1);

�@���̃G���[�𔭐�������B

Unused '@ts-expect-error' directive.

�������ł̌Ăяo����Ȃ��֐��̃`�F�b�N

�@TypeScript 3.7�ŁA�Ăяo����Ȃ��֐��̃`�F�b�N�@�\����������A�v���O���}�[���֐��̌Ăяo����Y�ꂽ�ꍇ�A�G���[���񍐂����悤�ɂȂ����B

function hasImportantPermissions(): boolean {
    // ...
}
// Oops!
if (hasImportantPermissions) {
//  ~~~~~~~~~~~~~~~~~~~~~~~
// This condition will always return true since the function is always defined.
// Did you mean to call it instead?
    deleteAllTheImportantFiles();
}

�@�����A���̃G���[�����肳���̂́Aif���̏����Ɍ����Ă����BTypeScript 3.9�ł́A���̋@�\���O���������i�ucond ? trueExpr : falseExpr�v�\���j�ł��T�|�[�g�����悤�ɂȂ����B

declare function listFilesOfDirectory(dirPath: string): string[];
declare function isDirectory(): boolean;
function getAllFiles(startFileName: string) {
    const result: string[] = [];
    traverse(startFileName);
    return result;
    function traverse(currentPath: string) {
        return isDirectory ?
        //     ~~~~~~~~~~~
        // This condition will always return true
        // since the function is always defined.
        // Did you mean to call it instead?
            listFilesOfDirectory(currentPath).forEach(traverse) :
            result.push(currentPath);
    }
}

�G�f�B�^�@�\�̉���

�@TypeScript�R���p�C���́A�قƂ�ǂ̎�v�ȃG�f�B�^��TypeScript�ҏW�G�N�X�y���G���X���x���邾���łȂ��A�uVisual Studio�v�t�@�~���[�̃G�f�B�^�Ȃǂ�JavaScript�G�N�X�y���G���X���x����BTypeScript 3.9�́A�ȉ��̂悤�ȐV����TypeScript�^JavaScript�@�\��񋟂���B

JavaScript�ł�CommonJS�ɂ�鎩���C���|�[�g

�@JavaScript�t�@�C����CommonJS���W���[�����g���������C���|�[�g���”\�ɂȂ����B

�@TypeScript�̏]���o�[�W�����́A�t�@�C���̎�ނɂ�����炸�A���[�U�[���ȉ��̂悤��ECMAScript�X�^�C���̃C���|�[�g��]��ł���Ƒz�肵�Ă����B

import * as fs from "fs";

�@�����AJavaScript�t�@�C���̍쐬���ɁA�N����ECMAScript�X�^�C���̃��W���[�����^�[�Q�b�g�ɂ���Ƃ͌���Ȃ��B�ȉ��̂悤��CommonJS�X�^�C����require(...)�C���|�[�g�𗘗p���郆�[�U�[�������B

const fs = require("fs");

�@TypeScript�́A���[�U�[�����p���Ă���C���|�[�g�̎�ނ������I�Ɍ��o���A�t�@�C���̃X�^�C�����N���[���Ȉ�т������̂ɕۂ‚悤�ɂȂ����B

�R�[�h�A�N�V���������s��ێ�

�@TypeScript�̃��t�@�N�^�����O��N�C�b�N�C���ł́A���s�����܂��ێ�����Ȃ��ꍇ�����������B���ɊȒP�Ȏ��̗�����Ă݂悤�B

const maxValue = 100;
/*start*/
for (let i = 0; i <= maxValue; i++) {
    // First get the squared value.
    let square = i ** 2;
    // Now print the squared value.
    console.log(square);
}
/*end*/

�@�G�f�B�^��/*start*/����/*end*/�܂ł�I�����A�V�����֐��𒊏o����ƁA���̂悤�ȃR�[�h�ɂȂ�B

const maxValue = 100;
printSquares();
function printSquares() {
    for (let i = 0; i <= maxValue; i++) {
        // First get the squared value.
        let square = i ** 2;
        // Now print the squared value.
        console.log(square);
    }
}
�i�N���b�N�ōĐ��A�o�T�FMicrosoft�j

�@����́A���z�I�ȃR�[�h�ł͂Ȃ��Bfor���[�v�̊e�X�e�[�g�����g�̊Ԃɋ󔒍s�����������A���t�@�N�^�����O�ɂ���Ă��ꂪ�폜����Ă��܂��Ă��邩�炾�BTypeScript 3.9�͎��̂悤�ɁA���̃R�[�h�̏�������ێ�����B

const maxValue = 100;
printSquares();
function printSquares() {
    for (let i = 0; i <= maxValue; i++) {
        // First get the squared value.
        let square = i ** 2;
        // Now print the squared value.
        console.log(square);
    }
}
�i�N���b�N�ōĐ��A�o�T�FMicrosoft�j

�����Ă���return���̃N�C�b�N�C��

�@�֐��̍Ō�̃X�e�[�g�����g�̒l��Ԃ��̂�Y��Ă��܂��ꍇ������B�A���[�֐��ɔg���ʁi�Ȃ݂������j��lj�����Ƃ������ɂ������B

// before
let f1 = () => 42
// oops - not the same!
let f2 = () => { 42 }

�@TypeScript�́A�����Ă���return�X�e�[�g�����g��lj�������A�g���ʂ��폜������A�I�u�W�F�N�g���e�����̂悤�Ɍ�����A���[�֐��{�̂ɃJ�b�R��lj������肷�邱�ƂŁA�N�C�b�N�C�����s����悤�ɂȂ����B

�i�N���b�N�ōĐ��A�o�T�FMicrosoft�j

�g�\�����[�V�����X�^�C���h tsconfig.json�t�@�C���̃T�|�[�g

�@�G�f�B�^�́A�t�@�C�����ǂ̍\���t�@�C���̑ΏۂɊ܂܂�邩�𗝉�����K�v������B�K�؂ȃI�v�V������K�p����ƂƂ��ɁA���̂ǂ̃t�@�C�������݂́g�v���W�F�N�g�h�Ɋ܂܂�邩�𗝉����邽�߂��B�f�t�H���g�ł́ATypeScript�̌���T�[�o�𗘗p����G�f�B�^�́A�t�@�C���̐e�f�B���N�g����tsconfig.json�����‚��āA������s���B

�@���ꂪ�኱���܂������Ȃ�1�‚̃P�[�X���������B�����tsconfig.json���A����tsconfig.json�t�@�C�����Q�Ƃ��邽�߂ɂ̂ݑ��݂���ꍇ�������B

// tsconfig.json
{
    "files": [],
    "references": [
        { "path": "./tsconfig.shared.json" },
        { "path": "./tsconfig.frontend.json" },
        { "path": "./tsconfig.backend.json" },
    ]
}

�@�����I�ɑ��̃v���W�F�N�g�t�@�C���̊Ǘ������s��Ȃ����̃t�@�C���́A�ꕔ�̊‹��ł͑����̏ꍇ�A�g�\�����[�V�����h�ƌĂ΂��B������tsconfig.*.json�t�@�C���́A����T�[�o�ɂ͌��o����Ȃ��B�����A���݂�.ts�t�@�C���͂����炭�A���̃��[�gtsconfig.json�Ō��y����Ă���v���W�F�N�g��1�‚Ɋ܂܂��B����T�[�o���A���̂��Ƃ𗝉����邱�Ƃ����߂��Ă����B

�@TypeScript 3.9�́A���������\���ł̕ҏW�V�i���I���T�|�[�g����悤�ɂȂ����B

Copyright © ITmedia, Inc. All Rights Reserved.

'; if( !this.isSubscription ) { this.insertTarget = document.querySelector('#cmsBody .subscription') || document.querySelector('#cmsBody .inner'); } }; BodyAdIMSWithCCE.prototype = Object.create(BodyAdContent.prototype); BodyAdIMSWithCCE.prototype.activate = function () { refreshGam('InArtSpecialLink'); } // global reference window.itm = itm; //entry point BodyAdEventBase.polyfill(); const bodyAdManager = BodyAdManager.getInstance(); bodyAdManager.addEventListener(BodyAdManager.EVENTS.READY, function (ev) { bodyAdManager.loadAdvertise(); }); bodyAdManager.init(); })();
�X�|���T�[����̂��m�点PR

���ڂ̃e�[�}

4AI by IT - AIAAA
Microsoft  WindowsőO2025
AI for GWjAO
[R[h^m[R[h Zg by IT - ITGWjArWlX̒SŊ􂷂gD
Cloud Native Central by IT - XP[uȔ\͂gD
�V�X�e���J���m�E�n�E �y�����i�r�zPR
���Ȃ��ɂ������߂̋L��PR

RSS�ɂ‚���

�A�C�e�B���f�B�AID�ɂ‚���

���[���}�K�W���o�^

��IT�̃��[���}�K�W���́A �������A���ׂĖ����ł��B���Ѓ��[���}�K�W�������w�ǂ��������B