Skip to content

Uncaught TypeError: Cannot read properties of undefined (reading 'RΦ') #48

@khusamov

Description

@khusamov

The following example does not work on Rollup.js

import "reflect-metadata"
import {reflect, CallSite} from 'typescript-rtti'

function foo<T>(num : number, callSite? : CallSite) {
	if (!callSite) throw 'callSite is undefined'
	console.log(
		reflect(callSite)
			.typeParameters[0]
			.isClass(Boolean),
		// => true

		reflect(callSite)
			.parameters[0]
			.isClass(Number),
		// => true

		reflect(callSite)
			.parameters[0]
			.is('literal'),
		// => true

		reflect(callSite)
			.parameters[0].as('literal')
			.value
		// => 123
	)
}

foo<Boolean>(123);

Error text:

index.js:18 Uncaught TypeError: Cannot read properties of undefined (reading 'RΦ')
    at Object.a (index.js:18:1)
    at foo (index.ts:17:20)
    at index.ts:39:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions