Skip to content

Commit

Permalink
fix: prepend pure annotation to defineFunction calls
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Sep 9, 2022
1 parent 622c751 commit b611788
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/tusken-schema/src/typescript/generateNativeFuncs.ts
@@ -1,6 +1,8 @@
import endent from 'endent'
import type { NativeFunc } from '../extract/extractFuncs'

const __PURE__ = '/*#__PURE__*/'

export function generateNativeFuncs(
nativeFuncs: NativeFunc[],
docs: Record<string, string>
Expand Down Expand Up @@ -135,7 +137,7 @@ export function generateNativeFuncs(
endent`
${constPrefix} ${name}: ${renderOutput(
fn
)} = defineFunction("${name}", "var")()${exportAlias}
)} = ${__PURE__} defineFunction("${name}", "var")()${exportAlias}
`
)
}
Expand All @@ -150,7 +152,7 @@ export function generateNativeFuncs(
endent`
${constPrefix} ${name}: {
${summary + signature.join('\n')}
} = define${returnSet ? 'Set' : ''}Function("${name}"${
} = ${__PURE__} define${returnSet ? 'Set' : ''}Function("${name}"${
fnConfig.length ? `, {${fnConfig.join(', ')}}` : ``
})${exportAlias}
`
Expand Down

0 comments on commit b611788

Please sign in to comment.