이러한 유형에는 일반적으로 알파 또는 베타 버전의 속성, 함수 또는 클래스가 없습니다. 이러한 경우 대부분 객체를 적절한 유형으로 캐스팅할 수 있습니다.
다음 오류는 MapOptions의 mapId 베타 속성으로 인해 발생합니다.
error TS2345: Argument of type '{ center: google.maps.LatLng; zoom: number;
mapId: string; }' is not assignable to parameter of type 'MapOptions'. Object
literal may only specify known properties, and 'mapId' does not exist in type
'MapOptions'.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-17(UTC)"],[[["\u003cp\u003eTypeScript can enhance Google Maps development by providing static typing and improved code maintainability.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003e@types/google.maps\u003c/code\u003e package from DefinitelyTyped for TypeScript support in your Google Maps projects.\u003c/p\u003e\n"],["\u003cp\u003eAlpha and beta Google Maps features may require type casting to avoid TypeScript errors.\u003c/p\u003e\n"],["\u003cp\u003eIn case of conflicting type definitions, consider utilizing the \u003ccode\u003eskipLibCheck\u003c/code\u003e compiler option to bypass type checking of external libraries.\u003c/p\u003e\n"],["\u003cp\u003eWhen necessary, configure \u003ccode\u003etypeRoots\u003c/code\u003e in your TypeScript configuration to ensure proper inclusion of Google Maps type definitions.\u003c/p\u003e\n"]]],[],null,["[TypeScript](https://www.typescriptlang.org/) is a typed superset of JavaScript\nthat compiles to plain JavaScript. The snippet below demonstrates simple usage\nof Google Maps using TypeScript. \n\n let map: google.maps.Map;\n const center: google.maps.LatLngLiteral = {lat: 30, lng: -110};\n\n function initMap(): void {\n map = new google.maps.Map(document.getElementById(\"map\") as HTMLElement, {\n center,\n zoom: 8\n });\n }\n\nGetting Started\n\nThe\n[DefinitelyTyped project](https://github.com/DefinitelyTyped/DefinitelyTyped) is\nan open source projects that maintains type\n[declaration files](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)\nfor many packages including Google Maps. The Google Maps JavaScript declaration\nfiles (see\n[source files](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/google.maps)\non GitHub) can be installed using NPM from the\n[@types/google.maps](https://www.npmjs.com/package/@types/google.maps) package. \n\n npm i -D @types/google.maps\n\n| **Note:** These types are automatically generated. To report an issue with these types, please open a [support ticket](https://issuetracker.google.com/savedsearches/558438).\n\nAlpha and Beta Features\n\nThe\n[types](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/google.maps)\ntypically do not have the properties, functions, or classes found in alpha or\nbeta releases. In many of these cases, the object can be cast to the correct\ntype.\n\nThe following error is caused by the `mapId` beta property for `MapOptions`. \n\n```\nerror TS2345: Argument of type '{ center: google.maps.LatLng; zoom: number;\nmapId: string; }' is not assignable to parameter of type 'MapOptions'. Object\nliteral may only specify known properties, and 'mapId' does not exist in type\n'MapOptions'.\n```\n\nThe above error can be corrected with the cast below. \n\n { center: {lat: 30, lng: -110}, zoom: 8, mapId: '1234' } as google.maps.MapOptions\n\nConflicting @types packages\n\nSome libraries may use a package other than\n[@types/google.maps](https://www.npmjs.com/package/@types/google.maps),\nwhich may cause conflicts. Use the\n[skipLibCheck](https://www.typescriptlang.org/tsconfig#skipLibCheck)\ncompiler option to avoid issues with inconsistent types. \n\n {\n \"compilerOptions\": {\n \"skipLibCheck\": true\n }\n }\n\nSpecifying typeRoots\n\nSome frameworks such as Angular may require specifying the\n[typeRoots](https://www.typescriptlang.org/tsconfig#typeRoots)\ncompiler option to include types installed from\n[@types/google.maps](https://www.npmjs.com/package/@types/google.maps)\nand all other \"@types\" packages.\n**Note:** By default all visible \"@types\" packages are included in your compilation. Packages in node_modules/@types of any enclosing folder are considered visible. \n\n {\n ...\n \"compilerOptions\": {\n ...\n \"typeRoots\": [\n \"node_modules/@types\",\n ],\n ...\n }\n }"]]