Skip to content

Commit

Permalink
Get rid of about half the type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
erikpukinskis committed Feb 13, 2023
1 parent 9986639 commit 7bad187
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 71 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build:types": "tsc --declaration --emitDeclarationOnly -p tsconfig.dist.json --skipLibCheck && tsc-alias -p tsconfig.json && mv dist/index.d.ts dist/lib.umd.d.ts",
"check:types": "tsc --noEmit -p tsconfig.json; if [ $? -eq 0 ]; then echo 8J+OiSBUeXBlcyBhcmUgZ29vZCEKCg== | base64 -d; else exit 1; fi",
"confgen": "npx confgen@latest @lib --name BabelPluginMacros typescript vite dist:lib",
"fix:format": "prettier --write src",
"lint": "kcd-scripts lint",
"setup": "npm install && npm run validate -s",
"test": "kcd-scripts test",
Expand Down Expand Up @@ -38,6 +39,7 @@
"@babel/parser": "^7.12.7",
"@babel/plugin-transform-modules-commonjs": "^7.16.7",
"@babel/types": "^7.12.7",
"@types/cosmiconfig": "^6.0.0",
"ast-pretty-print": "^2.0.1",
"babel-plugin-tester": "^10.0.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/create-macros.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {createMacro} = require('../')
import {createMacro} from '..'

test('throws error if it is not transpiled', () => {
const untranspiledMacro = createMacro(() => {})
Expand Down
15 changes: 6 additions & 9 deletions src/__tests__/fixtures/config/configurable.macro.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
const {createMacro} = require('../../..')
import {createMacro} from '../../..'

const configName = 'configurableMacro'
const realMacro = jest.fn()
module.exports = createMacro(realMacro, {configName})
// for testing purposes only
Object.assign(module.exports, {
realMacro,
configName,
})
// exports for testing purposes only
export const configName = 'configurableMacro'
export const realMacro = jest.fn()

export default createMacro(realMacro, ({configName} = {}))
2 changes: 1 addition & 1 deletion src/__tests__/fixtures/emotion.macro.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// this is a fake version of emotion
// const printAST = require('ast-pretty-print')
const {createMacro} = require('../../')
import {createMacro} from '../../'

module.exports = createMacro(emotionMacro)

Expand Down
Loading

0 comments on commit 7bad187

Please sign in to comment.