/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict * @format */ 'use strict'; function getCppTypeForAnnotation( type: | 'BooleanTypeAnnotation' | 'StringTypeAnnotation' | 'Int32TypeAnnotation' | 'FloatTypeAnnotation', ): string { switch (type) { case 'BooleanTypeAnnotation': return 'bool'; case 'StringTypeAnnotation': return 'std::string'; case 'Int32TypeAnnotation': return 'int'; case 'FloatTypeAnnotation': return 'Float'; default: (type: empty); throw new Error(`Receieved invalid typeAnnotation ${type}`); } } module.exports = { getCppTypeForAnnotation, };