Skip to content

Commit

Permalink
chore: typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
astahmer committed Dec 10, 2024
1 parent cd2883e commit 1b539a2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/plugins/optimize-lightningcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export default function optimizeLightCss(code: string | Root, options: OptimizeO

const codeStr = typeof code === 'string' ? code : code.toString()
const result = transform({
code: Buffer.from(codeStr),
// https://stackoverflow.com/questions/78790943/in-typescript-5-6-buffer-is-not-assignable-to-arraybufferview-or-uint8arr
code: Buffer.from(codeStr) as any as Uint8Array,
minify,
sourceMap: false,
filename: 'styles.css',
Expand Down
2 changes: 1 addition & 1 deletion packages/extractor/__tests__/extract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { default as ExtractSample } from './samples/ExtractSample?raw'

const project = createProject()

let sourceFile: SourceFile
let sourceFile: SourceFile | undefined
afterEach(() => {
if (!sourceFile) return

Expand Down
4 changes: 2 additions & 2 deletions packages/logger/src/create-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export interface LoggerConfig {

export const createLogger = (conf: LoggerConfig = {}): LoggerInterface => {
let onLog = conf.onLog
let level: LogLevel = conf.isDebug ? 'debug' : conf.level ?? 'info'
let level: LogLevel = conf.isDebug ? 'debug' : (conf.level ?? 'info')

const filter = conf.filter !== '*' ? conf.filter?.split(/[\s,]+/) ?? [] : []
const filter = conf.filter !== '*' ? (conf.filter?.split(/[\s,]+/) ?? []) : []

const getLevel = () => (filter.length ? 'debug' : level)

Expand Down
2 changes: 1 addition & 1 deletion packages/parser/src/vue-to-tsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const NodeTypes = {
export const vueToTsx = (code: string) => {
try {
const parsed = parse(code)
const fileStr = new MagicString(`<template>${parsed.descriptor.template?.content}</template>` ?? '')
const fileStr = new MagicString(`<template>${parsed.descriptor.template?.content}</template>`)

const rewriteProp = (prop: BaseElementNode['props'][number]) => {
if (
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/src/traverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ export function traverse(obj: any, callback: CallbackFn, options: TraverseOption
const keys = Object.keys(currentItem.value)
for (let i = keys.length - 1; i >= 0; i--) {
const key = keys[i]
const value = currentItem.value[key]
const value = (currentItem.value as Record<string, unknown>)[key]

const path = currentItem.path ? currentItem.path + separator + key : key
const paths = currentItem.paths.concat(key)

stack.push({
value,
value: value as Record<string, unknown>,
path,
paths,
depth: currentItem.depth + 1,
parent: currentItem.value,
parent: currentItem.value as Record<string, unknown>,
key,
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/token-dictionary/src/expand-token-references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const expandTokenReferences = (str: string, resolve: (path: string) => st
// Try to resolve the token path, which is the left part of the token fn
// `token(tokenPath, fallback))`
// ^^^^^^^^^
const resolved = tokenPath ? resolve(tokenPath) ?? esc(tokenPath) : tokenPath
const resolved = tokenPath ? (resolve(tokenPath) ?? esc(tokenPath)) : tokenPath

if (fallback) {
// `, colors.xxx.yyy` -> `colors.xxx.yyy`
Expand Down

0 comments on commit 1b539a2

Please sign in to comment.