Google 클로저 컴파일러에는 "@typedef"태그가 있지만 코드에서 사용할 수 있습니까? (나는 그것이 일 것이다라는 것을 알고 있지만, 눈살을 찌푸리게한다?)Google 클로저의 @typedef 태그 사용
그래서 여기 내 타입
/** * The plan object's typedef * @typedef {Object} */ Types.Plan = { "style": "bordersmall", "width": "50%", "height": "40%", "x": "20%", "y": "10%", "clickable": true, "moveable": true };
입니다 그리고 내 JSDoc 주석의 유형을 사용할 수 있습니다.
이 내 IDE가 전달 된 매개 변수에 따라서 선언 된 객체는 코드에서 임의의 장소에서 사용하지 않는
에 자동 완성 내게 줄 수 있습니다.
/** * The Instructions class * @param {Types.Plan} plan Plan for position and dimension * @param {Manager} manager The manager * @param {Instructions} parent This widget's parent's instructions * @return {Instructions} Returns the new instructions object */ Instructions = function(plan, manager, parent){ plan. }
이렇게 괜찮습니까? 아니면 더 나은 해결책이 있습니까?
또한 조합에 편리합니다 :'/ ** @typdef {string | number | boolean} */var myType;' –