{"_id":"remove-types","_rev":"2-dbbde9ab6c42c3e75205872e024a9dea","name":"remove-types","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"remove-types","author":{"name":"Chris Freeman"},"version":"0.0.1","license":"MIT","keywords":["typescript","babel","types"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"index.d.ts","scripts":{"ts:cjs":"tsc -p ts/cjs.tsconfig.json","ts:esm":"tsc -p ts/esm.tsconfig.json","ts:typedefs":"tsc -p ts/types.tsconfig.json && mv defs/* . && rimraf defs","ts:all":"yarn ts:esm && yarn ts:cjs && yarn ts:typedefs","build":"yarn clean && yarn ts:all","clean":"rimraf ./*.d.ts ./*.d.ts.map ./dist","lint":"eslint src test","prepublishOnly":"yarn test && yarn build","postpublish":"yarn clean","release":"release-it","test":"jest","test:watch":"jest --watch"},"devDependencies":{"@types/babel__core":"^7.1.18","@types/jest":"^27.4.0","@typescript-eslint/eslint-plugin":"^5.10.0","@typescript-eslint/parser":"^5.10.0","eslint":"^8.7.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","jest":"^27.4.7","release-it":"^14.12.4","rimraf":"^3.0.2","ts-jest":"^27.1.3","typescript":"^4.5.5"},"dependencies":{"@babel/core":"^7.16.10","@babel/plugin-syntax-decorators":"^7.16.7","@babel/plugin-transform-typescript":"^7.16.8","prettier":"^2.5.1"},"release-it":{"github":true},"gitHead":"cfe1af52df2dff1b4553e9c84d48c395f61c49f0","description":"A small library for transforming TypeScript code into JavaScript code in the least destructive way possible. This library exports a single function whose purpose is to preserve everything else about the code except for the actual TypeScript syntax itself.","_id":"remove-types@0.0.1","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-kAdb9wd5RGP+y251ysy00cIKOQmzk5XBnFTkYsgPzgkZvjmqZojHzkvzbTKZa1s2RAQeCh0VNlfEPSD0Y4J8xg==","shasum":"0092e8ff0c511d7556444b2df4e9b2d4d7ccc5d1","tarball":"https://registry.npmjs.org/remove-types/-/remove-types-0.0.1.tgz","fileCount":10,"unpackedSize":18115,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8ZSwCRA9TVsSAnZWagAAg6MQAJrCtAKRqBJteNgVQcXy\nOYyPdiK0i/QNrn9SNzzmExLfPDIwGL8lSK6qTfHygOgYjde8CHuCTOX6Df9O\nsVKOKjtN5tk4LoU4oeEWGGcCG5ZIC6LXIso4lc27HECR8mP095kwYnVOSUpe\nTEEInDmSdEpV9premjcN6EdMJqZT/G9Z9e4xRIu3NQmfrbnQwDAMTBQnMAEg\n3fiNRwKG2XFu3fACkud2qNzgfHpS5iq2BO0BhFYs+DGwO3eRaXHFUJ6o0x8S\n0+6/CIIHMDmeNjijRkLavXJS1miT2hJJfYSZBUh2KyEKL9f3O50Jx2nDExls\nWvdtrFIfO7J+3tucI3Obibfj5z154ARbS3rbuhFm3191pcwla0dbn++q/I9i\nn+UkctMeIdoatu1+SoZQxOiZFHa+Uh7oiRwCDZZdCpTexvqLeMrl7mN+yImc\n0Jc6aDbcBPJMvsnGA48LGHTkmYjLUEMmW4P67TlnYk7v2PFa2rkz5MEzYDYk\ndLF9jDLmmfwzlrGFafBJjw2+WDxKn+pZnqhh1yAHCMLnK9BKR6+i89p2JEPR\nGCCj4YKOVei4WjJvSVR5P55v56AZnIE56OM24kNN2pDs/kS2Ivv53C7KkUNj\n28Xev+AP1RrCUE5FUQJW4MY3PzyRbYfUy2PkoqDcDpzY6UNj7x0hpM6ZZpld\nT7Lr\r\n=CLlL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHKvZM6JVHc0Oe3BbP/9NY7vHLWgtB/eqRl9uCoOL7XCAiB7xuuTz5boRRyVkKq60Qnygs8FHe49WfMWooTkI27oFg=="}]},"_npmUser":{"name":"cafreeman","email":"cfreeman.code@gmail.com"},"directories":{},"maintainers":[{"name":"cafreeman","email":"cfreeman.code@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remove-types_0.0.1_1643222192415_0.8841982557270291"},"_hasShrinkwrap":false},"1.0.0":{"name":"remove-types","author":{"name":"Chris Freeman"},"version":"1.0.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/cafreeman/remove-types.git"},"keywords":["typescript","babel","types"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"index.d.ts","scripts":{"ts:cjs":"tsc -p ts/cjs.tsconfig.json","ts:esm":"tsc -p ts/esm.tsconfig.json","ts:typedefs":"tsc -p ts/types.tsconfig.json && mv defs/* . && rimraf defs","ts:all":"yarn ts:esm && yarn ts:cjs && yarn ts:typedefs","build":"yarn clean && yarn ts:all","clean":"rimraf ./*.d.ts ./*.d.ts.map ./dist","lint":"eslint src test","prepublishOnly":"yarn test && yarn build","postpublish":"yarn clean","release":"release-it","test":"jest","test:watch":"jest --watch"},"devDependencies":{"@types/babel__core":"^7.1.18","@types/jest":"^27.4.0","@typescript-eslint/eslint-plugin":"^5.10.0","@typescript-eslint/parser":"^5.10.0","eslint":"^8.7.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","jest":"^27.4.7","release-it":"^14.12.4","rimraf":"^3.0.2","ts-jest":"^27.1.3","typescript":"^4.5.5"},"dependencies":{"@babel/core":"^7.16.10","@babel/plugin-syntax-decorators":"^7.16.7","@babel/plugin-transform-typescript":"^7.16.8","prettier":"^2.5.1"},"release-it":{"github":true},"gitHead":"63832601d5345773940fc73bf896533dc4a20902","description":"A small library for transforming TypeScript code into JavaScript code in the least destructive way possible. This library exports a single function whose purpose is to preserve everything else about the code except for the actual TypeScript syntax itself.","bugs":{"url":"https://github.com/cafreeman/remove-types/issues"},"homepage":"https://github.com/cafreeman/remove-types#readme","_id":"remove-types@1.0.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-G7Hk1Q+UJ5DvlNAoJZObxANkBZGiGdp589rVcTW/tYqJWJ5rwfraSnKSQaETN8Epaytw8J40nS/zC7bcHGv36w==","shasum":"491119e8fce23f2f961fe2254e5a119a017d9a3d","tarball":"https://registry.npmjs.org/remove-types/-/remove-types-1.0.0.tgz","fileCount":10,"unpackedSize":18212,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAVzNCRA9TVsSAnZWagAA+vEP/RA8tu93A4OA7GvAxFCS\nn71rekya6mXOj1HUQxnk5SbrXFusylZ9pTjlWbWLpNL47+JWoWtyCDDRPUno\n7gcxNzE1h6gX4dJ3n16qps9n0cskgR/2Y6QMBPRVTSc73MzBB1kxXEUq+EfO\nkfE4kebKwuAEEx8eML3czep3m2hDw9hox25c2hLCFtOX4muPySmpe2yN8wRy\nsvoHVho6r2ZTfucEHxcD0PIJT9S/Q9943FwyS1P3UZsVw+mQRzVAwVw1VeCY\njH+N9TSgoHKCzUEqqwHFpmmDaO9+vbmJ6DtIIwtoSMSK1yYsi9SwfDQLA967\ngWr5SLnElI/ad4yT1jxmR99P3A7x+6/QpWx6hsUWz80tKmwk4Rx7ynpV+69q\nQt1JQFrLnRD+/ZaIiq0OZQGrgfwkbjdgYNhakp7mngqllnYLH/d9f76NbKUd\n89iAG2C5DdIEvGhw/pYfAxgc5c5ijkwwmN6MqXzqY5cYDFj2IxWXoCoL6TiZ\n/aeMpFlIAMRs08XzimeYZpLyDlQPvnrGDsltgLgKUe8/DlL1tlFjiulbeGAO\ndjVd2qv357S4edR1cMhOZIwQqkReMHjawzpSXfWDQOaVk5QT1aypANb45d6g\n37lpke+WPQxES3ruE351WGzh+zT/gn0ZfmzXuyFLav52P5qfpWC6SaxmdZSD\nI+NQ\r\n=GJV8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC8chKtOaqxCpSmS+XABhkyejt04cwlpEBfSqAF+zkWhAiBUrR8pFhUuvakrwgeuIV4lGLsDyUuUoaVVBGNA+RT3DA=="}]},"_npmUser":{"name":"cafreeman","email":"cfreeman.code@gmail.com"},"directories":{},"maintainers":[{"name":"cafreeman","email":"cfreeman.code@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remove-types_1.0.0_1644256461580_0.02110403292005736"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-26T18:36:32.415Z","0.0.1":"2022-01-26T18:36:32.551Z","modified":"2022-05-15T18:45:08.784Z","1.0.0":"2022-02-07T17:54:21.713Z"},"maintainers":[{"name":"cafreeman","email":"cfreeman.code@gmail.com"}],"description":"A small library for transforming TypeScript code into JavaScript code in the least destructive way possible. This library exports a single function whose purpose is to preserve everything else about the code except for the actual TypeScript syntax itself.","keywords":["typescript","babel","types"],"author":{"name":"Chris Freeman"},"license":"MIT","readme":"# `remove-types`\n\nA small library for transforming TypeScript code into JavaScript code in the least destructive way possible. This library exports a single function whose purpose is to preserve everything else about the code except for the actual TypeScript syntax itself. As a result, things like decorators and class fields should pass straight through without being transformed in any way.\n\n## Usage\n\n```js\nimport { removeTypes } from 'remove-types';\n\nconst original = `\ntype AnimalType = 'cat' | 'dog';\n\n// An interface for animals (this comment should be removed when transformed)\ninterface Animal {\n  type: AnimalType;\n  name: string;\n  age: number;\n}\n\nclass Cat implements Animal {\n  type: AnimalType = 'cat';\n  name: string;\n  age: number;\n\n  constructor(name: string, age: number) {\n    // This is the name of the animal (this comment should stay)\n    this.name = name;\n    this.age = age;\n  }\n}\n`;\n\nconsole.log(await removeTypes(original));\n\n/*\nclass Cat {\n  type = 'cat';\n\n  constructor(name, age) {\n    // This is the name of the animal (this comment should stay)\n    this.name = name;\n    this.age = age;\n  }\n}\n*/\n```\n\n## API\n\n### `removeTypes(code, prettierConfig = true): Promise<string>`\n\n- `code`: A string containing TypeScript code\n- `prettierConfig`:\n\n  - defaults to `true`\n  - By default, `removeTypes` will run Prettier with a very basic config on the transformed code before returning it. This allows us to clean up some of the \"low-hanging\" fruit leftover from the Babel transform, e.g. newlines at the beginning or end of the file.\n  - If you'd prefer to not run Prettier _at all_, passing `false` will bypass the Prettier pass entirely.\n  - If you'd prefer to use your own Prettier configuration, you can pass an object containing [Prettier configuration options](https://prettier.io/docs/en/options.html) and `removeTypes` will use it instead.\n\n- returns `Promise<string>`: a string containing the transformed JavaScript output.\n\n## Acknowledgements\n\nThis library is heavily indebted to [cyco130/detype](https://github.com/cyco130/detype) and began as an extraction and refactor of one of its core functions.\n","readmeFilename":"README.md","homepage":"https://github.com/cafreeman/remove-types#readme","repository":{"type":"git","url":"git+https://github.com/cafreeman/remove-types.git"},"bugs":{"url":"https://github.com/cafreeman/remove-types/issues"}}