typeKey
이 페이지에서

typeKey()

함수, 타입 분류

The runtime twin of KeyOf: turns any ShaderType value, literal or widened, into its canonical string key.

import { typeKey } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

function typeKey(t: ShaderType): string

매개변수

t ShaderType

The type to spell.

반환값

string

The canonical key string.

설명

Error messages use it (SD0002, SD0004: “expected vec3, got vec4”), and typeEq compares two types by it. Every case mirrors one arm of KeyOf; if they disagree, a value type-checks at author time but throws a spurious mismatch when the authoring code runs, or the reverse.

예제

예제

import { typeKey, vec3fT, texture2dArrayfT } from 'typeshade'
typeKey(vec3fT) // 'vec3<f32>'
typeKey(texture2dArrayfT) // 'texture_2d_array<f32>'

함께 보기

소스

src/core/ir/types.ts, 953행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고