이 페이지에서

다음과 함께

이 경고 범주는 qmllint에서 ‘ [with] ’로 표기됩니다.

문장과 함께

무슨 일이 있었나요?

JavaScript의 with 문이 사용되었습니다.

왜 문제가 될까요?

with 문은 한정되지 않은 식별자를 분석할 때 오탐을 유발할 수 있습니다. 또한, with 문은 최신 자바스크립트 표준에서 더 이상 사용하지 말 것을 권장하는 것으로 표시되어 있습니다.

예시

import QtQuick

Item {
    function f() {
        with (Math) {
            return PI
        }
    }
}

이 경고를 해결하려면 with 문을 해체(destructuring) 속성으로 대체하세요:

import QtQuick

Item {
    function f() {
        const { PI } = Math;
        return PI
    }
}

참고: 여기에서 더 많은 대체 방법을 확인할 수있습니다 .

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.